WC_AJAX::variation_bulk_action_variable_low_stock_amount()
Bulk action - Set Low Stock Amount.
Method of the class: WC_AJAX{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = WC_AJAX::variation_bulk_action_variable_low_stock_amount( $variations, $data );
- $variations(array) (required)
- List of variations.
- $data(array) (required)
- Data to set.
WC_AJAX::variation_bulk_action_variable_low_stock_amount() WC AJAX::variation bulk action variable low stock amount code WC 9.3.3
private static function variation_bulk_action_variable_low_stock_amount( $variations, $data ) { if ( ! isset( $data['value'] ) ) { return; } $low_stock_amount = wc_stock_amount( wc_clean( $data['value'] ) ); foreach ( $variations as $variation_id ) { $variation = wc_get_product( $variation_id ); if ( $variation->managing_stock() ) { $variation->set_low_stock_amount( $low_stock_amount ); } else { $variation->set_low_stock_amount( '' ); } $variation->save(); } }