Description
Helper method that updates all the post meta for an order based on it's settings in the WC_Order class.
Usage
Abstract_WC_Order_Data_Store_CPT::update_post_meta( $order );
Parameters
- $order
- ( mixed ) required –
Returns
void
Source
File name: woocommerce/includes/data-stores/abstract-wc-order-data-store-cpt.php
Lines: 1 to 30 of 30
protected function update_post_meta( &$order ) { $updated_props = array(); $meta_key_to_props = array( '_order_currency' => 'currency', '_cart_discount' => 'discount_total', '_cart_discount_tax' => 'discount_tax', '_order_shipping' => 'shipping_total', '_order_shipping_tax' => 'shipping_tax', '_order_tax' => 'cart_tax', '_order_total' => 'total', '_order_version' => 'version', '_prices_include_tax' => 'prices_include_tax', ); $props_to_update = $this->get_props_to_update( $order, $meta_key_to_props ); foreach ( $props_to_update as $meta_key => $prop ) { $value = $order->{"get_$prop"}( 'edit' ); if ( 'prices_include_tax' === $prop ) { $value = $value ? 'yes' : 'no'; } if ( update_post_meta( $order->get_id(), $meta_key, $value ) ) { $updated_props[] = $prop; } } do_action( 'woocommerce_order_object_updated_props', $order, $updated_props ); }
Called by
Invoked by
Calls
Call hooks
1 to 1 of 1