woocommerce_product_related_posts_relate_by_tag
Использование
add_filter( 'woocommerce_product_related_posts_relate_by_tag', 'wp_kama_woocommerce_product_related_posts_relate_by_tag_filter', 10, 2 ); /** * Function for `woocommerce_product_related_posts_relate_by_tag` filter-hook. * * @param $true * @param $product_id * * @return */ function wp_kama_woocommerce_product_related_posts_relate_by_tag_filter( $true, $product_id ){ // filter... return $true; }
- $true
- -
- $product_id
- -
Где вызывается хук
woocommerce_product_related_posts_relate_by_tag
woocommerce/includes/wc-product-functions.php 1044
$tags_array = apply_filters( 'woocommerce_product_related_posts_relate_by_tag', true, $product_id ) ? apply_filters( 'woocommerce_get_related_product_tag_terms', wc_get_product_term_ids( $product_id, 'product_tag' ), $product_id ) : array();
Где используется хук в WooCommerce
woocommerce/src/Blocks/BlockTypes/ProductCollection.php 1992
add_filter( 'woocommerce_product_related_posts_relate_by_tag', $tag_callback, PHP_INT_MAX );
woocommerce/src/Blocks/BlockTypes/ProductCollection.php 2001
remove_filter( 'woocommerce_product_related_posts_relate_by_tag', $tag_callback, PHP_INT_MAX );