Hi! Is it possible to hook into Cart Off Canvas and display a button to go to the shop when cart is empty? Thanks in advance! I wonder why it’s not default functionality - it is for the default cart page:
It seems it’s actually Woocommerce who displays this widget, so I’ll leave here a little snippet to achieve this for anyone looking for this functionality, put this in your child theme functions.php:
// add a button after empty cart in mini cart
add_action( 'woocommerce_after_mini_cart', 'minicart_custom' );
function minicart_custom() {
if ( WC()->cart->get_cart_contents_count() == 0 ) {
?>
<a href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>" class="x-btn"><?php _e( 'Return to shop', 'woocommerce' ) ?></a>
<?php
}
}
1 Like
Hi,
Thanks for sharing your code.
Have a nice day! 
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.