From aaecd9e97c8758466eb1e0849642040b45d97be1 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 23 Feb 2017 15:48:53 +0000 Subject: [PATCH] Handle _no_shipping_class --- includes/admin/class-wc-admin-post-types.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index 79b12dff310..6671a9a4551 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -940,9 +940,10 @@ class WC_Admin_Post_Types { } if ( ! empty( $_REQUEST['_shipping_class'] ) ) { - $shipping_class = '_no_shipping_class' == $_REQUEST['_shipping_class'] ? '' : wc_clean( $_REQUEST['_shipping_class'] ); - $shipping_class_id = $data_store->get_shipping_class_id_by_slug( $shipping_class ); - if ( $shipping_class_id ) { + if ( '_no_shipping_class' === $_REQUEST['_shipping_class'] ) { + $product->set_shipping_class_id( 0 ); + } else { + $shipping_class_id = $data_store->get_shipping_class_id_by_slug( wc_clean( $_REQUEST['_shipping_class'] ) ); $product->set_shipping_class_id( $shipping_class_id ); } } @@ -1079,9 +1080,10 @@ class WC_Admin_Post_Types { } if ( ! empty( $_REQUEST['_shipping_class'] ) ) { - $shipping_class = '_no_shipping_class' == $_REQUEST['_shipping_class'] ? '' : wc_clean( $_REQUEST['_shipping_class'] ); - $shipping_class_id = $data_store->get_shipping_class_id_by_slug( $shipping_class ); - if ( $shipping_class_id ) { + if ( '_no_shipping_class' === $_REQUEST['_shipping_class'] ) { + $product->set_shipping_class_id( 0 ); + } else { + $shipping_class_id = $data_store->get_shipping_class_id_by_slug( wc_clean( $_REQUEST['_shipping_class'] ) ); $product->set_shipping_class_id( $shipping_class_id ); } }