WooCommerce – Updating an order when status is not ‘pending’

I have some custom fields (ACF plugin) for my WooCommerce orders.

Problem is, that unless the ‘Order Status’ is set to wc-pending (i.e. Payment Pending), changes to the custom field will not save.

Read More

After spending many hours trying to debug the issue (with PHP XDebug), I’ve learned the following:

  • Order status is actually stored as the posts post_status

  • There seems to be a conflict on the WooCommerce ‘edit order’ page: post_status is both a WooCommerce input field, and a WordPress input field

  • When an order is editable (i.e. it’s post_status == 'wc-pending') data that is posted back from the ‘edit order’ page has $_POST['post_status'] = 'pending' (not wc-pending) as expected

  • When an order is not editable $_POST['post_status'] = 'wc-processing' (for example)

Please help! I understand that it is probably a good idea not to edit an order once the customer has paid for it. The custom fields need to be filled in once the order is taken.

Related posts

Leave a Reply