• Resolved cartseg

    (@cartseg)


    Hello,

    I have a question regarding Woocommerce hooks on single page: I want to add a text link before the Add to cart button hook in the single product page… so users can see info on sizes/dimensions etc… how to do that?
    I have added this as @cedcommerce suggested

    add_action('woocommerce_before_add_to_cart_button','ced_before_add_to_cart_notice');
    
    function ced_before_add_to_cart_notice(){
    //your text here
    }

    with
    <a href="#">Text link</a>

    instead of //your text here but it gives me a critical error. Any idea why?
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • @cartseg , where you add this code ?

    i.e in active theme functions.php ?

    
    add_action('woocommerce_before_add_to_cart_button','ced_before_add_to_cart_notice');
    
    function ced_before_add_to_cart_notice(){
        echo '<a href="#">Text link</a>';
    }

    Did you add like this ?

    I think you added without closing php tag, or without using echo

    Thanks,

    • This reply was modified 4 years, 8 months ago by cedcommerce.
    • This reply was modified 4 years, 8 months ago by cedcommerce.
    Thread Starter cartseg

    (@cartseg)

    I haven’t put the echo ??
    I will try again now, thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Text link before add to cart button’ is closed to new replies.