Custom Order Number Not Applied to API and Programmatically Created Orders
-
Hello Support Team,
I am using the Custom Order Numbers for WooCommerce plugin. I recently updated the plugin from version 1.13.0 to version 2.0.0 on June 24, 2026.
Since the update, I have encountered an issue with orders created programmatically.Issue
When an order is created using any programmatic method, such as:
- WooCommerce REST API
wc_create_order()- Other programmatic order creation methods
the custom order number is not being applied correctly.
Instead, the WordPress/WooCommerce post ID is used as the order number in:
- WooCommerce Admin
- Order emails
- Other places where the order number is displayed
For example, orders created manually through the WooCommerce interface work as expected, but orders created programmatically continue to use the original WordPress Post ID instead of the configured custom order number.
Testing Performed: To investigate the issue, I reverted the plugin back to version 1.13.0, and the problem does not occur there. I have also tested the newer plugin releases after version 1.13.0, including the latest version available as of today, and I consistently experience the same issue.
Therefore, I currently need to keep using version 1.13.0 as a workaround.
Expected Behavior: Orders created through the REST API or programmatically using functions such as
wc_create_order()should receive and display the configured custom order number in the same way as manually created orders.Actual Behavior: Programmatically created orders use the WordPress/WooCommerce Post ID instead of the configured custom order number, particularly in the WooCommerce Admin and email notifications.
Could you please investigate whether there was a change in the newer versions that affects programmatic order creation or the hook/filter used to generate custom order numbers?
I would appreciate a fix or a recommended workaround that allows us to use the latest version of the plugin while retaining custom order numbers for programmatically created orders.
Thank you.
You must be logged in to reply to this topic.