Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_AJAX::variation_bulk_toggle( array $variations, string $field )
Bulk toggle convenience function.
Description Description
Parameters Parameters
- $variations
-
(Required) List of variations.
- $field
-
(Required) Field to toggle.
Source Source
File: includes/class-wc-ajax.php
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(); } }