Create a WooCommerce Order Dynamically

Alright, so you’d like to create an order dynamically within WooCommerce? Well, let me tell you you found the right post!

Here is a super small snippet that will allow you to create a new order on the fly and dynamically when the function is triggered, simply load the function when needed and adjust it. You could easily improve it by adding  a lot of custom fields, but this is not the 1st intention of this post! Enjoy

About the author

Remi Hey! My name is Rémi Corson, I'm a French WordPress Developer, I code stuff and I write from time to time ;-) Buy a coffee
Show your support

Related Posts


  1. We are working on a project that requires creating order dynamically. Isn’t there a function where you specify the product ID and number of item to add to cart available in WooCommerce?

    Oh I see. the ‘add_product’ method in wc_create_order() object can be used.


  2. About this line… update_status(‘Completed’….. shouldn’t be this ‘wc-completed’ instead of ‘Completed’ and also how do i assign this order to a customer?

Leave a Reply