Home › Forums › WoodMart support forum › WooCommerce Hook not working
WooCommerce Hook not working
- This topic has 5 replies, 2 voices, and was last updated 4 years, 7 months ago by
Artem Temos.
-
AuthorPosts
-
April 13, 2021 at 9:56 am #282277
vagelisParticipantHello,
I want to create a custom hook and it doesn’t seem to work.
woocommerce_before_add_to_cart_formBut when I use the hook:
woocommerce_after_single_product_summaryit works correctly. Is there some other action that your theme uses and I cannot use mine?I write my code in functions.php of woodmart-child.
Here is the full code:
function custom_product(){ get_template_part('custom_product'); } add_action('woocommerce_before_add_to_cart_form', 'custom_product', 1);April 13, 2021 at 11:26 am #282325
Artem TemosKeymasterHello,
Could you please disable all plugins that are not related to our theme and provide us your admin access so we can check it?
Thank you in advance
April 13, 2021 at 12:10 pm #282352
vagelisParticipantI deactivated all the plugins. I still can’t use
woocommerce_before_add_to_cart_form. It’s not reading it, butwoocommerce_after_single_product_summarystill works.The only thing that I can think of, is that in admin theme options you have a textarea field that says: Before “Add to cart button” text area and After “Add to cart button” text area .
Maybe these use the
woocommerce_before_add_to_cart_form? But I searched inside the theme folder on every file, there are nowoocommerce_before_add_to_cart_form.What’s wrong?
April 13, 2021 at 1:36 pm #282393
Artem TemosKeymasterHello,
Could you please check how it works with some default WordPress themes like TwentyTwenty or WooCommerce Storefront to understand is it our theme issue or not?
Regards
April 13, 2021 at 3:04 pm #282437
vagelisParticipantIt’s not working either with TwentyTwenty theme. So I guess it’s a WooCommerce issue since all plugins except WC are deactivated.
There is a new version of WC 5.2
Woodmart theme has version 5.1Should I update WC? Does the theme work correctly with WC 5.2?
Also any idea why such a core hook like
woocommerce_before_add_to_cart_formisn’t working?April 14, 2021 at 6:15 am #282579
Artem TemosKeymasterIt looks like you don’t have this hook on the product page at all. Try to use some other hook for this purpose.
-
AuthorPosts
Tagged: woocommerce, WoodMart
- You must be logged in to create new topics. Login / Register
