ID, self::META_KEY, true ) : 'inherit'; woocommerce_wp_select( array( 'id' => 'artbees_qv_visibility', 'label' => esc_html__( 'Artbees Quick View for WooCommerce availability', 'artbees-quick-view' ), 'options' => array( 'inherit' => esc_html__( 'Inherit', 'artbees-quick-view' ), 'enabled' => esc_html__( 'Enable', 'artbees-quick-view' ), 'disabled' => esc_html__( 'Disable', 'artbees-quick-view' ) ), 'value' => in_array( $value, array( 'enabled', 'disabled' ), true ) ? $value : 'inherit', 'desc_tip' => true, 'description' => esc_html__( 'Inherit uses the global and category visibility rules.', 'artbees-quick-view' ) ) ); } public function save( $product_id ) { if ( ! current_user_can( 'edit_product', $product_id ) || ! current_user_can( 'edit_post', $product_id ) || ! isset( $_POST['woocommerce_meta_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['woocommerce_meta_nonce'] ) ), 'woocommerce_save_data' ) ) { return; } $value = isset( $_POST['artbees_qv_visibility'] ) ? sanitize_key( wp_unslash( $_POST['artbees_qv_visibility'] ) ) : 'inherit'; if ( 'inherit' === $value ) { delete_post_meta( $product_id, self::META_KEY ); } elseif ( in_array( $value, array( 'enabled', 'disabled' ), true ) ) { update_post_meta( $product_id, self::META_KEY, $value ); } } }