WooCommerce: Show Additional Button @ Mini Cart

Looking to enhance the functionality of your WooCommerce store’s mini cart widget?

Adding an additional button can provide a smoother user experience and increase conversion rates. Whether you want to offer quick access to the shop page, a deals page, or a shortcut to your contact form – customizing the mini cart with an extra button can be powerful.

In this tutorial, we’ll walk you through the steps to add an additional button to your WooCommerce mini cart. This easy-to-follow guide will help you boost user engagement and streamline your customers’ shopping journey.

The WooCommerce mini cart with an added custom button labeled “CLICK HERE,” providing an additional call-to-action for enhanced user engagement and convenience.

PHP Snippet: Add Button @ WooCommerce Mini-Cart Widget

/**
 * @snippet       Additional Woo Mini Cart Button
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 8
 * @community     https://businessbloomer.com/club/
 */

add_action( 'woocommerce_widget_shopping_cart_buttons', 'bbloomer_minicart_additional_button', 9999 );

function bbloomer_minicart_additional_button() {
	echo '<a class="button">CLICK HERE</a>';
}

The add_action function hooks the bbloomer_minicart_additional_button function to the woocommerce_widget_shopping_cart_buttons action. This ensures that the custom button is added to the mini cart’s button section.

The priority is set to 9999 to ensure this custom button is added after the default buttons provided by WooCommerce.

The bbloomer_minicart_additional_button function is defined to output a link with the class “button” and the text “CLICK HERE”, which will appear as a button in the mini cart.

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

    Rodolfo Melogli

    Business Bloomer Founder

    Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

    Questions? Feedback? Customization? Leave your comment now!
    _____

    If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

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