Automattic\WooCommerce\Internal\StockNotifications\Admin
SettingsController::add_disable_stock_notifications_checkbox
Setting to allow admins disabling bis on product level.
Method of the class: SettingsController{}
No Hooks.
Returns
null. Nothing (null).
Usage
$SettingsController = new SettingsController(); $SettingsController->add_disable_stock_notifications_checkbox();
SettingsController::add_disable_stock_notifications_checkbox() SettingsController::add disable stock notifications checkbox code WC 10.3.6
public function add_disable_stock_notifications_checkbox() {
if ( ! Config::allows_signups() ) {
return;
}
global $product_object;
if ( ! is_a( $product_object, 'WC_Product' ) ) {
return;
}
$enable_signups = 'no' !== $product_object->get_meta( Config::get_product_signups_meta_key() ) ? 'yes' : 'no';
wp_nonce_field( 'woocommerce-customer-stock-notifications-edit-product', 'customer_stock_notifications_edit_product_security' );
woocommerce_wp_checkbox(
array(
'id' => Config::get_product_signups_meta_key(),
'label' => __( 'Stock notifications', 'woocommerce' ),
'value' => $enable_signups,
'wrapper_class' => implode(
' ',
array_map(
function ( $type ) {
return 'show_if_' . $type;
},
Config::get_supported_product_types()
)
),
'description' => __( 'Let customers sign up to be notified when this product is restocked', 'woocommerce' ),
)
);
}