Code Duplication    Length = 5-5 lines in 3 locations

includes/class-wc-post-data.php 1 location

@@ 220-224 (lines=5) @@
217
	public static function pre_post_update( $post_id ) {
218
		$product_type = empty( $_POST['product-type'] ) ? 'simple' : sanitize_title( stripslashes( $_POST['product-type'] ) );
219
220
		if ( isset( $_POST['_visibility'] ) ) {
221
			if ( update_post_meta( $post_id, '_visibility', wc_clean( $_POST['_visibility'] ) ) ) {
222
				do_action( 'woocommerce_product_set_visibility', $post_id, wc_clean( $_POST['_visibility'] ) );
223
			}
224
		}
225
		if ( isset( $_POST['_stock_status'] ) && 'variable' !== $product_type ) {
226
			wc_update_product_stock_status( $post_id, wc_clean( $_POST['_stock_status'] ) );
227
		}

includes/admin/class-wc-admin-post-types.php 2 locations

@@ 1089-1093 (lines=5) @@
1086
			wp_set_object_terms( $post_id, $shipping_class, 'product_shipping_class' );
1087
		}
1088
1089
		if ( isset( $_REQUEST['_visibility'] ) ) {
1090
			if ( update_post_meta( $post_id, '_visibility', wc_clean( $_REQUEST['_visibility'] ) ) ) {
1091
				do_action( 'woocommerce_product_set_visibility', $post_id, wc_clean( $_REQUEST['_visibility'] ) );
1092
			}
1093
		}
1094
1095
		if ( isset( $_REQUEST['_featured'] ) ) {
1096
			if ( update_post_meta( $post_id, '_featured', 'yes' ) ) {
@@ 1245-1249 (lines=5) @@
1242
			wp_set_object_terms( $post_id, $shipping_class, 'product_shipping_class' );
1243
		}
1244
1245
		if ( ! empty( $_REQUEST['_visibility'] ) ) {
1246
			if ( update_post_meta( $post_id, '_visibility', wc_clean( $_REQUEST['_visibility'] ) ) ) {
1247
				do_action( 'woocommerce_product_set_visibility', $post_id, wc_clean( $_REQUEST['_visibility'] ) );
1248
			}
1249
		}
1250
1251
		if ( ! empty( $_REQUEST['_featured'] ) ) {
1252
			if ( update_post_meta( $post_id, '_featured', stripslashes( $_REQUEST['_featured'] ) ) ) {