5

I recently discovered that Magento 2's checkout flow does not place an order during the PHP page request. Instead, an additional RESTFUL API request is made to the application to place the order.

Does anyone know where this REST request takes place in Magento 2's code?

  • Do you mean where on the client (browser) side is the code that posts it, or where on the PHP server side is it processed (i.e. \Magento\Sales\Api\OrderManagementInterface::place())? – Vinai Mar 9 '16 at 19:51
  • @Vinai I meant where the API request is made, not where its processed. I wasn't sure if it happened on the frontend, or if the backend code made a CURL request. – Alan Storm Mar 9 '16 at 20:12
4

It happens in Magento/Checkout/view/frontend/web/js/action/place-order.js

        return storage.post(
            serviceUrl, JSON.stringify(payload)
        ).done(
            function () {
                if (redirectOnSuccess) {
                    window.location.replace(url.build('checkout/onepage/success/'));
                }
            }
        )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.