cancel
Showing results for 
Search instead for 
Did you mean: 

Suppress "$0.00" when using Free Shipping?

SOLVED

Suppress "$0.00" when using Free Shipping?

When I'm using free shipping Magento displays "$0.00" as the shipping amount.  I would like to replace the "$0.00" with some custom text.  How do I do that?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Suppress "$0.00" when using Free Shipping?

@david_barnhart

Good to know that it is working fine.

Please accept as a solution so it will help to others as well.

View solution in original post

7 REPLIES 7

Re: Suppress "$0.00" when using Free Shipping?

HI @david_barnhart,

You can change the $0 amount as per the below steps. 
 
1. Edit the below template file of your current theme.

template/checkout/onepage/shipping_method/available.phtml

or copy from base theme to your current theme folder.

app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml

2.  In the available.phtml file, look for the following code (around line 56):

<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
<?php echo $_excl; ?>
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
    (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
<?php endif; ?>
</label

3. Replace it with the following:

<label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $_rate->getMethodTitle() ?>
<?php if($_rate->getPrice() > 0) : ?>        
<?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
<?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
<?php echo $_excl; ?>
<?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
    (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
<?php endif; ?>
<?php else : ?>
      (<?php echo $this->__('Free Shipping'); ?>)
<?php endif; ?>
</label>

4. Save available.phtml, and clear your Magento caches. "Free Shipping" will now appear next to all methods containing a $0 amount on the One-Page-Checkout shipping section or you can also add your if condition to check shipping method code as well. 

 


The file for the calculate shipping block is app/design/frontend/[theme_path]/template/checkout/cart/shipping.phtml. For future reference, you can determine the exact template paths loaded on the frontend by enabling Template Path Hints in the Magento configuration. You can find a quick tutorial on how to do this here:


https://support.magerewards.com/article/1534-how-do-i-turn-on-template-path-hints


Reference: https://stackoverflow.com/questions/19015759/magento-show-free-shipping-text

 

I hope it will help you. 

Re: Suppress "$0.00" when using Free Shipping?

Thank you Vimal.  There is another place I need to make the same change.  The sidebar contains  "You Checkout Progress". There is  "SHIPPING METHOD" there and it also displays the "$0.00"

 

How do I remove it from there as well?

Re: Suppress "$0.00" when using Free Shipping?

Hi @david_barnhart,

Good to hear that it works well for you.

You can edit the phtml for that block as well.
You can get template path link from admin configuration settings change.
For more info to edit template path link, please follow below link.
https://support.magerewards.com/article/1534-how-do-i-turn-on-template-path-hints

I Hope it will help you.

Re: Suppress "$0.00" when using Free Shipping?

Thank you vimal but I think I did it wrong.

 

FIle I updated:

app/design/frontend/base/default/template/checkout/onepage/shipping_method.phtml

 

Original code:

    <?php if ($this->getShippingMethod()): ?>
    <?php echo $this->getShippingDescription() ?>

    <?php $_excl = $this->getShippingPriceExclTax(); ?>
    <?php $_incl = $this->getShippingPriceInclTax(); ?>
    <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
        <?php echo $_incl; ?>
        <?php else: ?>
        <?php echo $_excl; ?>
        <?php endif; ?>
    <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
        (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
        <?php endif; ?>

    <?php else: ?>
    <?php echo $this->__('Shipping method has not been selected yet') ?>
    <?php endif; ?>

I changed it to:

    <?php if ($this->getShippingMethod()): ?>
    <?php echo $this->getShippingDescription() ?>

    <?php $_excl = $this->getShippingPriceExclTax(); ?>
    <?php $_incl = $this->getShippingPriceInclTax(); ?>
    <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
        <?php echo $_incl; ?>
        <?php else: ?>
        <?php echo $_excl; ?>
        <?php endif; ?>
    <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
         (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>) <?php endif; ?> <?php else : ?> (<?php echo $this->__('Free Shipping'); ?>) <?php endif; ?>

    <?php else: ?>
    <?php echo $this->__('Shipping method has not been selected yet') ?>
    <?php endif; ?>

Re: Suppress "$0.00" when using Free Shipping?

Hi @david_barnhart 

Try once the following code:

<?php if ($this->getShippingMethod()): ?>
    <?php echo $this->getShippingDescription() ?>

    <?php $_excl = $this->getShippingPriceExclTax(); ?>
    <?php $_incl = $this->getShippingPriceInclTax(); ?>
    <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
         if($_incl == 0)
         {
            (<?php echo $this->__('Free Shipping'); ?>)
         }else{
            <?php echo $_incl; ?>
         }
        <?php else: ?>
         if($_excl == 0)
         {
            (<?php echo $this->__('Free Shipping'); ?>)
         }else{
            <?php echo $_excl; ?>
         }
        <?php endif; ?>
    <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
         if($_incl == 0)
         {
            (<?php echo $this->__('Free Shipping'); ?>)
         }else{
            (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>);
         }
    <?php endif; ?>    
    <?php else: ?>
    <?php echo $this->__('Shipping method has not been selected yet') ?>
    <?php endif; ?>

I hope it will help you!

Re: Suppress "$0.00" when using Free Shipping?

It is working!

 

Thank you Vimal!

Re: Suppress "$0.00" when using Free Shipping?

@david_barnhart

Good to know that it is working fine.

Please accept as a solution so it will help to others as well.