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);
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.
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?