Redeem Now
Read More
Read now
Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    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 :



    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 🙂

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*

    Be the first to comment.

    Back to Top
    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