Skip to content

Commit 5224eab

Browse files
committed
Update PR with new logic
1 parent 85e3cee commit 5224eab

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

includes/abstracts/abstract-wc-order.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -738,25 +738,12 @@ public function get_shipping_methods() {
738738
return $this->get_items( 'shipping' );
739739
}
740740

741-
/**
742-
* Sets shipping method title.
743-
*
744-
* @param array $shipping_method
745-
*/
746-
public function set_shipping_method( $shipping_method ) {
747-
$this->set_prop( 'shipping_method', $shipping_method );
748-
}
749-
750741
/**
751742
* Gets formatted shipping method title.
752743
*
753744
* @return string
754745
*/
755-
public function get_shipping_method( $context = 'view' ) {
756-
if ( 'edit' === $context ) {
757-
return $this->get_prop( 'shipping_method' );
758-
}
759-
746+
public function get_shipping_method() {
760747
$names = array();
761748
foreach ( $this->get_shipping_methods() as $shipping_method ) {
762749
$names[] = $shipping_method->get_name();

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/class-wc-order.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class WC_Order extends WC_Abstract_Order {
3939
'date_modified' => null,
4040
'discount_total' => 0,
4141
'discount_tax' => 0,
42-
'shipping_method' => '',
4342
'shipping_total' => 0,
4443
'shipping_tax' => 0,
4544
'cart_tax' => 0,

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

Lines changed: 0 additions & 2 deletions
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
/**
@@ -173,7 +172,6 @@ protected function update_post_meta( &$order ) {
173172
'_date_completed' => 'date_completed',
174173
'_date_paid' => 'date_paid',
175174
'_cart_hash' => 'cart_hash',
176-
'_shipping_method' => 'shipping_method',
177175
);
178176

179177
$props_to_update = $this->get_props_to_update( $order, $meta_key_to_props );

0 commit comments

Comments
 (0)