5

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

  • Are you asking how to prevent the 'Shipping & Tax' from displaying? Or, are you trying to modify the final price? – Tim Hallman May 18 '15 at 17:36
  • To modify the final price – Pratik bhatt May 19 '15 at 4:25
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; ?>
  • I mean to change the shipping amount on checkout – Pratik bhatt May 19 '15 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);
        }


    }
  • This removes shipping cost from everything, with no conditional logic as per the OP's question. – Tim Hallman May 18 '15 at 18:54
  • Using template file only block the shipping at frontend level but in quote object shipping will be added – Sourav May 19 '15 at 3:35
  • What If I want to change the amount? – Pratik bhatt May 19 '15 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.