This topic has 2 replies, 2 voices, and was last updated 4 years, 4 months ago ago by Rose Tyler
Hello,
I write for a request. I need to change the checkout button link inside the minicart at the top – the one which opens on hover on the cart icon in the header – changing it from checkout link to cart link.
I notice that when users click on this button (checkout) they’re redirected to checkout.
Is there a way to change this via code so that it links to the cart page? We need this because it’s useful for us. Maybe some woocommerce snippet to put in the functions?
At the moment we hide it via css display:none, we need this change because we put a plugin which opens a popup on the cart (not checkout) page.
Screenshot: https://ibb.co/vJ0XyrX
If you could provide me any kind of snippet for it or options in the theme it would be amazing.
Thanks!
Hello,
Try to use the next code in functions.php of your child theme:
add_action('wp', 'etheme_custom_template_hooks', 70);
function etheme_custom_template_hooks() {
remove_action( 'woocommerce_widget_shopping_cart_buttons', 'woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
add_action( 'woocommerce_widget_shopping_cart_buttons', 'et_woocommerce_widget_shopping_cart_proceed_to_checkout', 20 );
}
function et_woocommerce_widget_shopping_cart_proceed_to_checkout() {
echo '<a href="' . esc_url( wc_get_cart_url() ) . '" class="button checkout wc-forward">' . esc_html__( 'Cart', 'woocommerce' ) . '</a>';
}
Regards
You must be logged in to reply to this topic.Log in/Sign up