wc_product_pre_has_global_unique_id
Gives plugins an opportunity to verify Unique ID uniqueness themselves.
Использование
add_filter( 'wc_product_pre_has_global_unique_id', 'wp_kama_wc_product_pre_has_global_unique_id_filter', 10, 3 );
/**
* Function for `wc_product_pre_has_global_unique_id` filter-hook.
*
* @param bool|null $has_global_unique_id Set to a boolean value to short-circuit the default Unique ID check.
* @param int $product_id The ID of the current product.
* @param string $sku The Unique ID to check for uniqueness.
*
* @return bool|null
*/
function wp_kama_wc_product_pre_has_global_unique_id_filter( $has_global_unique_id, $product_id, $sku ){
// filter...
return $has_global_unique_id;
}
- $has_global_unique_id(true|false|null)
- Set to a boolean value to short-circuit the default Unique ID check.
- $product_id(int)
- The ID of the current product.
- $sku(строка)
- The Unique ID to check for uniqueness.
Список изменений
| С версии 9.1.0 | Введена. |
Где вызывается хук
wc_product_pre_has_global_unique_id
woocommerce/includes/wc-product-functions.php 759
$has_global_unique_id = apply_filters( 'wc_product_pre_has_global_unique_id', null, $product_id, $global_unique_id );