Support » Fixing WordPress » How can I disable a “view cart” btn until after a product is added to the cart?

  • Resolved Greg Robertson

    (@517design)


    I have added a function that adds a “view cart” button next to the “add to cart” button. I would like the button to be disabled (either not showing or greyed out) until someone adds the product to the cart.

    Here is my function:

    function action_woocommerce_after_add_to_cart_button() {
    
    echo '<div class="woocommerce-message krank-mesg" role="alert"><a href="./cart/" class="button wc-forward">VIEW CART</a> <p class"woo-fx-added"><span>The New Formula X Driver</span> has been added to your cart.</p></div>';
    
    add_action( 'woocommerce_after_add_to_cart_button', 'action_woocommerce_after_add_to_cart_button', 10, 0 ); 

    thanks in advance for any help,
    Greg

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I disable a “view cart” btn until after a product is added to the cart?’ is closed to new replies.