wc_product_has_global_unique_id
Gives plugins an opportunity to verify Unique ID uniqueness themselves.
Использование
add_filter( 'wc_product_has_global_unique_id', 'wp_kama_wc_product_has_global_unique_id_filter', 10, 3 ); /** * Function for `wc_product_has_global_unique_id` filter-hook. * * @param boolean $global_unique_id_found Whether the Unique ID is found. * @param int $product_id The ID of the current product. * @param string $sku The Unique ID to check for uniqueness. * * @return boolean */ function wp_kama_wc_product_has_global_unique_id_filter( $global_unique_id_found, $product_id, $sku ){ // filter... return $global_unique_id_found; }
- $global_unique_id_found(true|false)
- Whether the Unique ID is found.
- $product_id(int)
- The ID of the current product.
- $sku(строка)
- The Unique ID to check for uniqueness.
Список изменений
С версии 9.1.0 | Введена. |
Где вызывается хук
wc_product_has_global_unique_id
woocommerce/includes/wc-product-functions.php 722
if ( apply_filters( 'wc_product_has_global_unique_id', $global_unique_id_found, $product_id, $global_unique_id ) ) {