Create a second “add-to-cart” button in WooCommerce

By default, only one single “Add to cart” button is displayed on all single product pages, but what if for some reason you’d like to display 2x “Add to cart” buttons? Here’s how you can add a second “Add-to-cart” button on all products in WooCommerce.

add_action( 'woocommerce_after_single_product_summary', 'custom_second_cart_button', 10 );
function custom_second_cart_button(){
  woocommerce_template_single_add_to_cart();
}

You can find more single product page hooks here: https://businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/ if you’d like to change where the button is added.

You can add this code to your site following the instructions here:

How to add custom code to your WooCommerce/WordPress site the right way

Have any feedback? Be sure to let me know here: Contact me

2 thoughts on “Create a second “add-to-cart” button in WooCommerce

  1. Hi, I saw our article online, i’m trying to add a second button, but instead of 2x add to cart, i want the second button to take the customer directly to checkout….
    I have seen lots of options to change the add to cart to buy….do yu have any ideas┬┐

    1. Howdy!

      You could use the following piece of code to bypass the cart page and go directly to the checkout page.

      add_filter( ‘woocommerce_add_to_cart_redirect’, ‘wc_redirect_checkout_add_cart’ );

      function wc_redirect_checkout_add_cart() {
      return wc_get_checkout_url();
      }

Share your thoughts

Your email address will not be published. Required fields are marked *