Handle _no_shipping_class

This commit is contained in:
Mike Jolley 2017-02-23 15:48:53 +00:00
parent 6f02cda453
commit aaecd9e97c
1 changed files with 8 additions and 6 deletions

View File

@ -940,9 +940,10 @@ class WC_Admin_Post_Types {
} }
if ( ! empty( $_REQUEST['_shipping_class'] ) ) { if ( ! empty( $_REQUEST['_shipping_class'] ) ) {
$shipping_class = '_no_shipping_class' == $_REQUEST['_shipping_class'] ? '' : wc_clean( $_REQUEST['_shipping_class'] ); if ( '_no_shipping_class' === $_REQUEST['_shipping_class'] ) {
$shipping_class_id = $data_store->get_shipping_class_id_by_slug( $shipping_class ); $product->set_shipping_class_id( 0 );
if ( $shipping_class_id ) { } 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 ); $product->set_shipping_class_id( $shipping_class_id );
} }
} }
@ -1079,9 +1080,10 @@ class WC_Admin_Post_Types {
} }
if ( ! empty( $_REQUEST['_shipping_class'] ) ) { if ( ! empty( $_REQUEST['_shipping_class'] ) ) {
$shipping_class = '_no_shipping_class' == $_REQUEST['_shipping_class'] ? '' : wc_clean( $_REQUEST['_shipping_class'] ); if ( '_no_shipping_class' === $_REQUEST['_shipping_class'] ) {
$shipping_class_id = $data_store->get_shipping_class_id_by_slug( $shipping_class ); $product->set_shipping_class_id( 0 );
if ( $shipping_class_id ) { } 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 ); $product->set_shipping_class_id( $shipping_class_id );
} }
} }