Up Arrow

How to Create Manual Order and Invoice Programmatically in Magento

  • Date: January 18th, 2016 | by benzirhasan
  • Facebook
  • Tweet
  • Googleplus
  • IN
magento manual order and invoice

If you are using Magento platform for your eCommerce store and want to create manual order & invoice programmatically you might find this blog post helpful.

Few days ago, I required creating manual order programmatically for one of my project. I did some research but failed to find the expected solution and ended up doing it myself. It was not a complex job; you can easily do it if you have some Magento development skills. Now let me share the steps to get it done

1 First off you need to set Store Id by changing the code as below:

2 Set your customer information / address and create customer if not exist. Do this as the following code:

3 Declare sales quote model to create sales order. See the code below:

4 Assign customer to the quote as the following code:

5 This is the most important step which will execute the final process. From this step you will get assigned product, assigned billing/shipping address, assigned payment method, created order and invoice. See the code below:

N.B: This code will only work for virtual product. If you want to use it for other product types just add shipping address and shipping method in the final step.

That’s It, you should be good! If you try it in a different way I definitely would like to hear that, Please feel free to contact us if you have any question or need support.

P.S. We would appreciate if you help spread the word about our magento extensions

Recent Posts