Menu Close
    Hire us Request quote Reading list Switch to dark mode
    lockdownWebkulUp

    Use of Js Mixins in Magento2

    Use of Js Mixins in Magento2

    Today I am going to explain that how you can use js mixins in magento 2 in this article. Suppose you have to do some task before any js script’s function run or to extend a function or to modify some data without overwrite of js so this blog will be very helpful for you.

    At first you will need to create requirejs-config.js under app/code/Company/Module/view/frontend, like below:

     


    Now, create set-shipping-information-mixin.js file under app/code/Company/Module/view/frontend/web/js/action to extend original function. So I am just appending some data to shipping address only for example, here is the code :

     

    . . .
    Subscribe Articles

    Just enter your email below to subscribe and receive weekly updates about the most interesting similar articles.

    You need to accept conditions to receive letters.
    You've Subscribed!

    Share article via

    . . .


     

    Now if you console quote.shippingAddress() in js then result will be as follows :

    Hope this blog will help you to develop custom functionality in your module in a better way. Try this and if you have any query then just comment below 🙂

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close