WooCommerce Cart Widget: Change “View Cart” to “Continue Shopping”
-
On the Cart Widget, I’d like to change the “View Cart” button to “Continue Shopping”, and have the button link to the main shop page. (We don’t see a need to “view cart” on the widget because you’re already viewing the cart at the moment. To continue shopping or check out would seem to be the next two logical choices).
I didn’t see any hooks available for cart buttons unless I missed one, so I looked for the template.
I found mini-cart.php inside of “cart” in the templates folder from the core, then put a copy of it a copy of “cart” in my “woocommerce” folder in my child theme. Here are the original button codes below, lines 84-87…
<p class="buttons"> <a href="<?php echo esc_url( wc_get_cart_url() ); ?>" class="button wc-forward"><?php _e( 'View Cart', 'woocommerce' ); ?></a> <a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="button checkout wc-forward"><?php _e( 'Checkout', 'woocommerce' ); ?></a> </p>
I decided to change the “View Cart” text to “Continue Shopping”, and on a guess decided to try
wc_get_shop_url()
to see if I’d get the url of the shop page in there. So it became…<p class="buttons"> <a href="<?php echo esc_url( wc_get_shop_url() ); ?>" class="button wc-forward"><?php _e( 'Continue Shopping', 'woocommerce' ); ?></a> <a href="<?php echo esc_url( wc_get_checkout_url() ); ?>" class="button checkout wc-forward"><?php _e( 'Checkout', 'woocommerce' ); ?></a> </p>
I tested to see if I had a change in my widget, and it did not change from “View Cart” to “Continue Shopping”. So it’s time to ask for your help.
Thanks!
- The topic ‘WooCommerce Cart Widget: Change “View Cart” to “Continue Shopping”’ is closed to new replies.