Archived topic
Woocommerce and childtheme
9 replies · Started by Max on September 1, 2021
I am editting in the child theme of generate press. To change things for woocommerce. This doesn't work. Any reason for that?
Hi Max,
Not sure I fully understand your question.
Can you tell me what exactly are you trying to change?
What file have you changed? What changes you've made to this file?
Let me know :)
https://elextensions.com/remove-add-to-cart-woocommerce/
remove_action('woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 20);
i want to delete the add to cart buttons on my website.
Hi Max,
This isn't something the theme support can help with as those are WooCommerce filters.
That being said, the code looks like it should work.
Have you checked with WooCommerce' support team?
But i have a lot of times that i want to change something in the child theme. And then it doesnt work. But other people say it work. But is it a woocommerce problem then? Or something weird in the child theme
The child theme itself cannot be the issue - a default child theme is basically an empty file that grabs the files from the parent theme.
You can try:
- Activate the parent theme.
- Add the code using the Code Snippets plugin and test if that works:
https://docs.generatepress.com/article/adding-php/#code-snippet
Also, just a note that GP Premium has an option in the customizer to disable the Add to Cart button in the shop page:
https://docs.generatepress.com/article/woocommerce-overview/#shop
So you only need the snippet to disable it on single product pages.
I am you really thankfull
No problem :)