WooCommerce $order->save() and wc_get_order() problems with database cache
-
When the database cache is activated on W3 Total Cache, sometimes we have problems when saving a WooCommerce order and then immediately getting it from the database where not all details saved before are available on the newly gotten object.
For example:
//Get the order and update some meta on it $order = wc_get_order( 1234 ); $order-> update_meta_data( 'some_field', 'some_data' ); $order->save(); //Let other developers do something to the order before working with it again $order = apply_filters( 'some_action_on_the_order', $order ); //Get the order again (because other developers may have changed something on it) and work with it again $order = wc_get_order( 1234 ); echo $order->get_meta( 'some_field' ); //We do not get 'some_data' if W3 Total cache database cache is active
Anything we can do between saving the order and getting it again to make sure when we get it is completely updated?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘WooCommerce $order->save() and wc_get_order() problems with database cache’ is closed to new replies.