0

I want to know how to create orders programmatically.

I want to create an order in the same time, add cart product when I click on by "confirm my order".

  1. I want my customer to add product to his cart.
  2. Then, when he goes on "checkout", my custom page is displaying with some info (such as addresses...).
  3. Then when he clicks on "validate", his comment is created in magento but he doesn't had to go to the payment step.
  4. The order is created only for information (in magento), because the "real" order will be manage by an API.

    I know it's possible, using helper (or model, but I can't find the link) :

https://webkul.com/blog/create-quote-and-order-programmatically-in-magento2/

This seems to work (I found this link on other topics in stackExchange), but some methods are deprecated, I want to avoid this. Can anyone help ?

EDIT : according to Magento Doc (https://devdocs.magento.com/guides/v2.1/extension-dev-guide/persistent-entities.html), the way to replace deprecated method is by using resource model. But I'm looking in Magento Github to find order resource (https://github.com/magento/magento2/tree/2.1/app/code/Magento/Sales/Model/ResourceModel/Order) but I don't find it...

Your Answer

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

Browse other questions tagged or ask your own question.