Skip to content

Commit f041155

Browse files
authored
Merge pull request woocommerce#16713 from woocommerce/fix/php-notice-on-item-order
Fix PHP notice on item order
2 parents 4d1f636 + 5224eab commit f041155

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

includes/class-wc-checkout.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,9 @@ public function create_order( $data ) {
299299
$order->{"set_{$key}"}( $value );
300300

301301
// Store custom fields prefixed with wither shipping_ or billing_. This is for backwards compatibility with 2.6.x.
302-
} elseif ( 0 === stripos( $key, 'billing_' ) || 0 === stripos( $key, 'shipping_' ) ) {
302+
// TODO: Fix conditional to only include shipping/billing address fields in a smarter way without str(i)pos.
303+
} elseif ( ( 0 === stripos( $key, 'billing_' ) || 0 === stripos( $key, 'shipping_' ) )
304+
&& ! in_array( $key, array( 'shipping_method', 'shipping_total', 'shipping_tax' ) ) ) {
303305
$order->update_meta_data( '_' . $key, $value );
304306
}
305307
}

includes/data-stores/class-wc-order-data-store-cpt.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class WC_Order_Data_Store_CPT extends Abstract_WC_Order_Data_Store_CPT implement
6666
'_shipping_address_index',
6767
'_recorded_sales',
6868
'_recorded_coupon_usage_counts',
69-
'_shipping_method',
7069
);
7170

7271
/**

0 commit comments

Comments
 (0)