0

A question about WooCommerce/Wordpress

Is there a way to recognize which loop you are in?

If I wanted use the hook woocommerce_after_shop_loop_item_title only in the loop of related products, how can i do?

thanks

1

from https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/

global $woocommerce_loop;
if ( is_product() && $woocommerce_loop['name'] == 'related' ) {
    add_action('woocommerce_after_shop_loop_item_title','your_custom_function',20);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.