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.
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.