0

Is it possible to disable shipping method from getting executed in the cart page. We only want it to call it in the checkout process.

4
  • Please clarify what you mean by "executed in the cart page". May 12, 2016 at 5:54
  • While in the cart page the CollectRates method of the Shipping method is called and rate is calculated. I want to stop this and only want to call the shipping method while checking out. I'm currently looking at the Mage_Checkout_CartController page but not sure from where the shipping method is getting called. May 12, 2016 at 6:01
  • 1
    Have a look at the logic taking place within Mage_Checkout_Model_Cart::save(). However, even if you address your issue by doing a rewrite and preventing it from saving, I have a feeling that there are several other places where this takes place as well. May 12, 2016 at 6:16
  • you don't want Estimate Shipping and Tax calculation on cart page? May 12, 2016 at 7:21

2 Answers 2

1

This should work for you. First, create an observer:

        <checkout_cart_save_before>
            <observers>
                <prevent_saving>
                    <class>mymodulename/observer</class>
                    <method>preventSaving</method>
                </prevent_saving>
            </observers>
        </checkout_cart_save_before>

Here is the observer function:

public function preventSaving(Varien_Event_Observer $observer)
{
    $cart = $observer->getEvent()->getCart();
    if($cart instanceof Mage_Checkout_Model_Cart){
        $quote = $cart->getQuote();
        $quote->preventSaving();
    }
    return $this;
}
1
  • @nikhil did my answer work for you? if so, please accept, its been a while. thanks Aug 12, 2016 at 14:19
0

I am not 100% sure I understand the question. I assume you want to remove the shipping calculations block from the cart page.

Open the file local.xml in your theme, and find the tag

<checkout_cart_index translate="label">

And remove the block checkout.cart.shipping via <remove name="left"/>

<checkout_cart_index translate="label">
   <remove name="checkout.cart.shipping"/>
</checkout_cart_index>

OR

If you are using the checkout.xml directly in your theme then comment/remove the below line

<block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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