Home › Forums › Basel support forum › Show Remainder for Free Shipping in Cart & Checkout Page
Show Remainder for Free Shipping in Cart & Checkout Page
- This topic has 4 replies, 2 voices, and was last updated 7 years ago by
ochow7.
-
AuthorPosts
-
November 9, 2018 at 3:57 am #88202
ochow7ParticipantHello,
If I offer free shipping for orders that are $50+, and someone has $20 in their cart, is there a way to show on the CART PAGE as well as the CHECKOUT PAGE the difference that’s left in order to qualify for free shipping?
Is there a setting that I’m missing?
November 9, 2018 at 7:36 am #88249
Artem TemosKeymasterHi,
Sorry, but there is no such option in our theme and WooCommerce by default. It may require additional code customization or extra plugin but we don’t have an instruction for this. It is out of our theme support scope.
Regards
November 9, 2018 at 3:15 pm #88457
ochow7ParticipantI understand.
I just found this website that offers two solutions using code:
I just downloaded the plugin, MY CUSTOM FUNCTIONS, because I’m not a coder and don’t understand how to edit PHP files. I inputted the code, and it says it causes an error.
Can you kindly take a quick look at the two codes they offer for:
#1 – Show Amount Left for Free Shipping on Cart Page
#2 – Show Amount Left for Free Shipping on Checkout PageI would like the color of the box the match the themes color.
Genuinely, I would appreciate your help with adding this crucial piece of functionality.
Thanks.
November 9, 2018 at 7:03 pm #88510
Artem TemosKeymasterSorry, but we don’t know how this code is supposed to work and we don’t have an instruction to fix it.
Regards
November 9, 2018 at 8:45 pm #88544
ochow7ParticipantIf anyone is following along, I found a great solution on this website.
Download a plugin that will allow you to add Custom PHP and enter the following code:
/** * Show a message at the cart/checkout displaying * how much to go for free shipping. */ function my_custom_wc_free_shipping_notice() { if ( ! is_cart() && ! is_checkout() ) { // Remove partial if you don't want to show it on cart/checkout return; } $packages = WC()->cart->get_shipping_packages(); $package = reset( $packages ); $zone = wc_get_shipping_zone( $package ); $cart_total = WC()->cart->get_displayed_subtotal(); if ( WC()->cart->display_prices_including_tax() ) { $cart_total = round( $cart_total - ( WC()->cart->get_discount_total() + WC()->cart->get_discount_tax() ), wc_get_price_decimals() ); } else { $cart_total = round( $cart_total - WC()->cart->get_discount_total(), wc_get_price_decimals() ); } foreach ( $zone->get_shipping_methods( true ) as $k => $method ) { $min_amount = $method->get_option( 'min_amount' ); if ( $method->id == 'free_shipping' && ! empty( $min_amount ) && $cart_total < $min_amount ) { $remaining = $min_amount - $cart_total; wc_add_notice( sprintf( 'Add %s more to get free shipping!', wc_price( $remaining ) ) ); } } } -
AuthorPosts
Tagged: cart, checkout, free shipping
The topic ‘Show Remainder for Free Shipping in Cart & Checkout Page’ is closed to new replies.
- You must be logged in to create new topics. Login / Register
