I want to use this generator in a cron job to periodically create orders for a test site. And I want to be able to receive push notifications on the WooCommerce iOS app every time an order is created. I'm mainly using this for dog-fooding the iOS app.
The problem is that, the iOS app will only receive push notifications if the Order's status is processing. And this generator randomizes the order status so it can be tricky to rely on. It'd be great if I can specify what status to use for the generated orders.
Changes
This adds a --status argument to generate orders with a specific status. For example, running this command would generate orders with the processing status:
wp wc generate orders 10 --status=processing
Error Handling
If the user enters an invalid status, the order will be set to pending instead. This is done automatically by WC_Order.set_status().
Testing
Run this command:
wp wc generate orders 10 --status=completed
Confirm that 10 orders were created with the “Completed” status.
Run this command:
wp wc generate orders 10
Confirm that 10 orders were created with random statuses.
Why
I want to use this generator in a cron job to periodically create orders for a test site. And I want to be able to receive push notifications on the WooCommerce iOS app every time an order is created. I'm mainly using this for dog-fooding the iOS app.
The problem is that, the iOS app will only receive push notifications if the Order's status is
processing
. And this generator randomizes the order status so it can be tricky to rely on. It'd be great if I can specify what status to use for the generated orders.Changes
This adds a
--status
argument to generate orders with a specific status. For example, running this command would generate orders with theprocessing
status:Error Handling
If the user enters an invalid status, the order will be set to
pending
instead. This is done automatically byWC_Order.set_status()
.Testing
Run this command:
Run this command: