| 1 |
<?php |
| 2 |
/** |
| 3 |
* Update to 0.4.6 |
| 4 |
* - fix reports bug. |
| 5 |
* |
| 6 |
* @version 0.4.6 |
| 7 |
* @package WCPOS\WooCommercePOS |
| 8 |
*/ |
| 9 |
|
| 10 |
if ( ! \defined( 'ABSPATH' ) ) { |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
// fix pos orders. |
| 15 |
$woocommerce_pos_args = array( |
| 16 |
'post_type' => array( 'shop_order' ), |
| 17 |
'post_status' => array( 'any' ), |
| 18 |
'posts_per_page' => - 1, |
| 19 |
'fields' => 'ids', |
| 20 |
'meta_query' => array( |
| 21 |
array( |
| 22 |
'key' => '_pos', |
| 23 |
'value' => 1, |
| 24 |
'compare' => '=', |
| 25 |
), |
| 26 |
), |
| 27 |
); |
| 28 |
|
| 29 |
$woocommerce_pos_query = new WP_Query( $woocommerce_pos_args ); |
| 30 |
|
| 31 |
foreach ( $woocommerce_pos_query->posts as $woocommerce_pos_order_id ) { |
| 32 |
// check _order_tax and _order_shipping_tax for reports. |
| 33 |
if ( ! get_post_meta( $woocommerce_pos_order_id, '_order_tax', true ) ) { |
| 34 |
update_post_meta( $woocommerce_pos_order_id, '_order_tax', 0 ); |
| 35 |
} |
| 36 |
if ( ! get_post_meta( $woocommerce_pos_order_id, '_order_shipping_tax', true ) ) { |
| 37 |
update_post_meta( $woocommerce_pos_order_id, '_order_shipping_tax', 0 ); |
| 38 |
} |
| 39 |
} |
| 40 |
|