14th January 2021
Framework / CMS
WooCommerce [Version: Since 3.3.0]
Creating new WooCommerce orders programmatically.
- $args (array) (Optional): The default order arguments you wish to override.
Return Value(s)Returns a new order object on success which can then be used to add additional data.
Arguments you may override include:
Examples of wc_create_order()
<?php $user_id = get_current_user_id();
$args = array(
'customer_id' => $user_id,
'status' => 'on-hold','
customer_note' => 'Your order is on hold.',
'parent' => '1234',
'created_via' => 'Promotion Page',
'cart_hash' => '6516s1fv61asd21f6a5a1vad651d651v651asd'
$new_order = wc_create_order($args);
Used In Projects
Was This Helpful?
If this post has helped you, please let me know. Your feedback will be highly appreciated and will help me build better content.