WordPress at Your Fingertips
function is not described

WC_AJAX::variation_bulk_toggle() private WC 1.0

Bulk toggle convenience function.

{} It's a method of the class: WC_AJAX{}

No Hooks.

Return

null. Nothing.

Usage

$result = WC_AJAX::variation_bulk_toggle( $variations, $field );
$variations(array) (required)
List of variations.
$field(string) (required)
Field to toggle.

Code of WC_AJAX::variation_bulk_toggle() WC 5.9.0

private static function variation_bulk_toggle( $variations, $field ) {
	foreach ( $variations as $variation_id ) {
		$variation  = wc_get_product( $variation_id );
		$prev_value = $variation->{ "get_$field" }( 'edit' );
		$variation->{ "set_$field" }( ! $prev_value );
		$variation->save();
	}
}