woocommerce_product_import_create_variation_of_existing_product │ хук-фильтр │ WC 11.1.0

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.

Использование

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(массив)
Parsed row data.

Список изменений

С версии 11.1.0 Введена.

Где вызывается хук

WC_Product_CSV_Importer::import()
woocommerce_product_import_create_variation_of_existing_product
woocommerce/includes/import/class-wc-product-csv-importer.php 1478
$create_variation = apply_filters( 'woocommerce_product_import_create_variation_of_existing_product', true, $parsed_data );

Где используется хук в WooCommerce

Использование не найдено.