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.


Was this helpful? Please buy me a coffee






This code should be added to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update.

Share your thoughts

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