woocommerce_product_import_create_variation_of_existing_product
Filters whether a new variation should be created for an existing variable product when updating existing products.
Only fires for variation rows that passed validation, so it can veto the creation but not force it.
Usage
add_filter( 'woocommerce_product_import_create_variation_of_existing_product', 'wp_kama_woocommerce_product_import_create_variation_of_existing_filter', 10, 2 );
/**
* Function for `woocommerce_product_import_create_variation_of_existing_product` filter-hook.
*
* @param bool $create_variation Whether to create the new variation instead of skipping the row.
* @param array $parsed_data Parsed row data.
*
* @return bool
*/
function wp_kama_woocommerce_product_import_create_variation_of_existing_filter( $create_variation, $parsed_data ){
// filter...
return $create_variation;
}
- $create_variation(true|false)
- Whether to create the new variation instead of skipping the row.
- $parsed_data(array)
- Parsed row data.
Changelog
| Since 11.1.0 | Introduced. |
Where the hook is called
woocommerce_product_import_create_variation_of_existing_product
woocommerce/includes/import/class-wc-product-csv-importer.php 1389
$create_variation = apply_filters( 'woocommerce_product_import_create_variation_of_existing_product', true, $parsed_data );