Home Forums WoodMart support forum WooCommerce Hook not working

WooCommerce Hook not working

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #282277

    vagelis
    Participant

    Hello,

    I want to create a custom hook and it doesn’t seem to work.

    woocommerce_before_add_to_cart_form

    But when I use the hook: woocommerce_after_single_product_summary it 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);
    #282325

    Artem Temos
    Keymaster

    Hello,

    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

    #282352

    vagelis
    Participant

    I deactivated all the plugins. I still can’t use woocommerce_before_add_to_cart_form. It’s not reading it, but woocommerce_after_single_product_summary still 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 no woocommerce_before_add_to_cart_form.

    What’s wrong?

    #282393

    Artem Temos
    Keymaster

    Hello,

    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

    #282437

    vagelis
    Participant

    It’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.1

    Should 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_form isn’t working?

    #282579

    Artem Temos
    Keymaster

    It looks like you don’t have this hook on the product page at all. Try to use some other hook for this purpose.

Viewing 6 posts - 1 through 6 (of 6 total)