@@ 1078-1087 (lines=10) @@ | ||
1075 | ||
1076 | // Product Type |
|
1077 | $product_type = null; |
|
1078 | if ( isset( $data['type'] ) ) { |
|
1079 | $product_type = wc_clean( $data['type'] ); |
|
1080 | wp_set_object_terms( $product_id, $product_type, 'product_type' ); |
|
1081 | } else { |
|
1082 | $_product_type = get_the_terms( $product_id, 'product_type' ); |
|
1083 | if ( is_array( $_product_type ) ) { |
|
1084 | $_product_type = current( $_product_type ); |
|
1085 | $product_type = $_product_type->slug; |
|
1086 | } |
|
1087 | } |
|
1088 | ||
1089 | // Virtual |
|
1090 | if ( isset( $data['virtual'] ) ) { |
@@ 864-873 (lines=10) @@ | ||
861 | ||
862 | // Product Type. |
|
863 | $product_type = null; |
|
864 | if ( isset( $request['type'] ) ) { |
|
865 | $product_type = wc_clean( $request['type'] ); |
|
866 | wp_set_object_terms( $product->id, $product_type, 'product_type' ); |
|
867 | } else { |
|
868 | $_product_type = get_the_terms( $product->id, 'product_type' ); |
|
869 | if ( is_array( $_product_type ) ) { |
|
870 | $_product_type = current( $_product_type ); |
|
871 | $product_type = $_product_type->slug; |
|
872 | } |
|
873 | } |
|
874 | ||
875 | // Default total sales. |
|
876 | add_post_meta( $product->id, 'total_sales', '0', true ); |