Change Woocommerce Order Number when Order is Imported via API v3
I am currently importing orders from a marketplace to Woocommerce using the Worpress API. The Marketplace Order ID is added in the Customer Note Field in the Woocommerce order upon import. The Woocommmerce Order number is auto assigned from Woocommerce. I would like to use a Code Snippet to change the Woocommerce order number to the marketplace order ID stored in the Wocommerce Order´s customer Note field when the order is imported to Woocommerce. After reviewing the Wordpress Order API Docu, I am still not sure if I need to update the number or order_key to achieve this. Highlighted in yellow is the number I am looking to replace:
How do I record a discount and a coupon for API orders on the WP Admin backend
So I realized that in using the WP REST API to create orders, the discount_total
parameter shows the discount amount (which is probably calculated by subtracting the line_items['total']
value from the total cost of the items the customer purchased).