Magento 2 – Javascript Mixins

I needed to change the Magento API when the order is placed in the checkout. I needed to change it to post to a custom API. Magento’s checkout uses javascript to make an AJAX request to place the order. Alan Storm describes this process in this article. I was able to accomplish this by using Magento 2 javascript mixins. Magento’s javascript mixins are explained in this Alan Storm article.  Below are example code snippets. These code snippets show how to wrap the place order javascript to change the API service URL to a custom URL.

 

Articles:

https://alanstorm.com/magento-2-checkout-application-order-placing/

https://alanstorm.com/the-curious-case-of-magento-2-mixins/

Leave a Reply

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