2

I have an already running Magento CE 1.8.1 website running with two stores, and more to come. My client has asked me to find a way that can tell a customer how much more they need to spend before they qualify for "Free Shipping" (Subtotal of $49 or more - US only).

Tuga Sunwear - UPF 50+ Sun Protective Swimwear for Kids & Adults

I have looked around "magento connect" and did not see anything that can do this. Here are my ideas/requirements for this "micro-extension"

1) Somewhere on the page/site/block a banner is shown that says "Free Standard Shipping for US orders of $49 or more" on top, and below a 'counter' of sorts is displayed showing "You only need $XX.XX more to qualify!"

2) This needs to be shopper specific, so it would need to connect to the cookies or something being used to keep any "guest" or "logged in" users separate for others, even from the same IP address

3) The banner area can be clicked on to show details about the shipping information provided. The "$XX.XX to qualify" area can be clicked on to send them to the shopping cart review

I'm not asking for an extension to be built from here, but if someone can point me in a direction of what coding to use to pull a "subtotal" for the cart with *math to get an amount, and only show $0 when the amount is reached, instead of counting into negative amounts. I can figure out the rest or have a developer/freelancer tweak the rest.

Thanks for any help you guys and gals can provide!


Finally posting my solution that seems to work on any page, in any location:

<?php 
$quote = Mage::getSingleton('checkout/session')->getQuote();
$freeShippingValue = Mage::getStoreConfig('carriers/freeshipping/free_shipping_subtotal');
if ($quote->getSubtotal() < $freeShippingValue):
$subtotalamt = Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();
$sumtotal = $freeShippingValue - $subtotalamt;
Mage::helper('checkout')->formatPrice($sumtotal);?>
<p>Free US Ground Shipping with <span style="color: #CC2727;">$<?php print (number_format($sumtotal, 2, '.', '')); ?></span> 
more added to your cart.</p>
<?php endif ?>

This will display: Free US Ground Shipping with $XX.00 more added to your cart.

Feel free to change the text as needed. Free shipping amount with automatically update as it is saved in the Config.

4

You can get the value needed for free shipping like this:

$freeShippingSubtotal = Mage::getStoreConfig('carriers/freeshipping/free_shipping_subtotal');

You can get the subtotal of the products in the cart like this:

$cartSubtotal = Mage::getSingleton('checkout/session')->getQuote()->getSubtotal();

Now you can create a custom block (or even use core/template) with a custom template where you can do the math.

  • What if the free_shipping_subtotal is set in a shopping cart price rule and is not a global limit. How could I retrieve it programmitacally? – Gilles Lesire Mar 23 '17 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.