5

how to change WooCommerce product title on loop, for example change product tile in shop, category page etc.?

I am looking for the hook that can help to solve this issue. When going to woocommerce/content-product.php it is showing

do_action('woocommerce_before_shop_loop_item_title');

echo '<div class="title-wrapper">';
do_action('woocommerce_shop_loop_item_title');
echo '</div>';

please help

I want to change the product tile on shop page, category page etc.. But in single product page, or cart, checkout page I don't want to change title. Also what about shortcodes [products ids="12,34,56,"];?
How can I change the title?

2
  • Hi, What title you want to give?
    – Tristup
    Dec 18, 2017 at 5:56
  • (product tile→ product title?)
    – greybeard
    Apr 11, 2021 at 8:24

1 Answer 1

6
remove_action('woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title',10);
add_action('woocommerce_shop_loop_item_title','fun',10);
function fun()
{
   echo 'Your Title for the product';
}

The above code will remove the Default Title and call another function which will show your own title in place. Now you have write your own logic for each product title. I tested with it, and it works for me.

Hope it works for you too.

2
  • Do you need the ajax loading into your other questions or the page loading time is the main concern
    – Tristup
    Dec 18, 2017 at 6:36
  • First i will show category 1 and it's 4 products . When user scroll down the page then the next 4 products from category 1 should load . this will continue until all product from category 1 loaded . Afte this Category 2 title will show . Then 4 products from category 2 should load ,When user scroll down the page then the next 4 products from category 2 should be load like this . Dec 18, 2017 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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