Woocommerce hooks and child theme files

Hello,

Problem 1

I need to make a custom edit for my client and he wants to add the category of the product before product title in shop archive or anywhere a product is shown.

I could reach that using this code:

I know this function is working because I have tested it on another instance with different theme. The problem is that hook "woocommerce_before_shop_loop_item_title" is not working and I'm wondering if the devs have deleted those hooks or changed their name? I don't know but I would like to get a result.

P.S. I have tried other hooks like "woocommerce_single_product_summary" and it worked but of course, that's not the hook that I need but the before item title I do.


Problem 2

While I was trying to use child theme files, I copy the files in child theme, I assure that I'm actively using child theme, and my files aren't recognized by child theme. Several files that I've tried "single-product.php", "archive-product.php", "content-product.php".


Thank you in advance,

Sebastian.

Comments

  • Hi,

    1) Are you using the custom templates, or the ones from the theme options?

    2) Are copying the files only or the whole path to them? If the files only, please, try to copy the whole path. The catalogs do not have to have files you do not use.


    Best regards

  • Hello,


    1) I guess I'm using from theme options because I do not created any template but using your builder in Templates.

    2) I have copied only the files that I need from parent theme to child theme like that:

    Parent: /themes/betheme/woocommerce/content-product.php

    Child: /themes/betheme-child/woocommerce/content-product.php


    Thank you,

    Sebastian.

  • 1) I contacted the dev team, and they said this hook was not added to our theme.

    We will add it in the next update.

    2) If you followed the steps for Child theme installation like in our documentation, and the path is correct, then your changes should work. However, there is the possibility that you made some mistakes in the code, which is why it is not working. However, we do not provide help with the file modifications, so I cannot tell what exactly could be the reason.


    Best regards

Sign In or Register to comment.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.