5

Hello I wish to remove shipping tax from the quote programmatically under specific condition.So please give me idea how to remove it.

2
  • Are you asking how to prevent the 'Shipping & Tax' from displaying? Or, are you trying to modify the final price? May 18, 2015 at 17:36
  • To modify the final price May 19, 2015 at 4:25

2 Answers 2

1

If you wish to simply remove the 'Estimate Shipping and Tax' block dynamically, then you can do so from

app/design/frontend/default/Your_Theme/template/checkout/cart.phtml

Find the line of code which looks like

<?php if (!$this->getIsVirtual()): echo $this->getChildHtml('shipping'); endif; ?>

and replace it with something like

<?php if (!$this->getIsVirtual() && $conditionIsTrue):
    echo $this->getChildHtml('shipping');
endif; ?>
1
  • I mean to change the shipping amount on checkout May 19, 2015 at 4:25
1

Hi i have made custom module & use below event to remove the shipping rate from grand total


    <sales_quote_address_collect_totals_after > 
             <observers >
                  <kinex_order >
                       <class > < kinex_order > <class> / observer>
                       <method > setShippingCost </method>
                   </kinex_order >
                 </observers>

         </sales_quote_address_collect_totals_after >
public function setShippingCost(Varien_Event_Observer $observer){
       $events=$observer->getEvent();
        $address=$events->getQuoteAddress();
        if($address->getAddressType()=='shipping'){

     //echo $address->removeAllShippingRates();
        // exit;

     //$address->setShippingAmount(0);
      $samount=  $address->getShippingAmount();
     $address->getSubtotalInclTax();
     $gt= $address->getGrandTotal();
     $total=$gt-$samount;
     $address->setGrandTotal($total);
    $address->removeAllShippingRates();

    //print_r($rates);

        //$address->setCollectShippingRates(true);
        }


    }
3
  • This removes shipping cost from everything, with no conditional logic as per the OP's question. May 18, 2015 at 18:54
  • Using template file only block the shipping at frontend level but in quote object shipping will be added
    – Sourav
    May 19, 2015 at 3:35
  • What If I want to change the amount? May 19, 2015 at 4:24

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.