-
Webmaster
Hi GenerateSupport,
May you please share function snippet to change icon URL?
Right now it goes to http://10.0.0.103:8261/cart/ but I desire “checkout” instead like ⟶ http://10.0.0.103:8261/CHECKOUT/

-
Hi there,
Can you try this?
add_filter( 'woocommerce_get_cart_url', 'tu_custom_cart_url' ); function tu_custom_cart_url() { return 'URL TO YOUR CHECKOUT'; } -
Webmaster
Thanks!!
This is great.
-
You are welcome 🙂
-
Webmaster
If anyone else needs, here is working version
add_action( 'template_redirect', function() { // Don't redirect if coming from checkout $referer = wp_get_referer(); $is_from_checkout = $referer && strpos( $referer, 'checkout' ) !== false; if ( is_cart() && ! $is_from_checkout ) { if ( WC()->cart->is_empty() ) { wp_safe_redirect( get_permalink( wc_get_page_id( 'shop' ) ) ); exit(); } else { wp_safe_redirect( 'http://10.0.0.103:8261/checkout/' ); exit(); } } });* Cart is empty + cart icon clicked → Redirect to shop
* Cart has items + cart icon clicked → Redirect to checkout
* “Return to cart” clicked from checkout → Shows the cart page normally (no redirect loop) -
Thanks for sharing your solution 🙂
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.