Question

I am using Magento 1.9.3.2.

I need customization like, Shipping cost should not show in the Cart page, but shown in the Checkout page.

Is possible to make like Shipping cost should be calculated only in checkout page, not in the Cart page even user logged in.

Était-ce utile?

La solution 2

I Created a event with observer. Here is the Code:

<frontend>
    <events>
        <checkout_cart_save_before>
            <observers>
            <your_module_shipping_observer>
                <type>singleton</type>
                <class>Your_Module/observer</class>
                <method>setFreeShipping</method>
            </your_module_shipping_observer>
            </observers>
        </checkout_cart_save_before>
    </events>
</frontend>

Observer function setFreeShipping Code:

public function setFreeShipping($observer) {
    $event = $observer->getEvent();
    $cart = $event->getCart();
    $shippingaddress = $cart->getQuote()->getShippingAddress();
    $shippingaddress->setShippingMethod('')->save();
    return;
}

Reference and credits: link

Autres conseils

You can use the following code somewhere when cart loads:

$quote->setTotalsCollectedFlag(false);
$quote->getShippingAddress()->unsetData('cached_items_all');
$quote->getShippingAddress()->unsetData('cached_items_nominal');
$quote->getShippingAddress()->unsetData('cached_items_nonnominal');
$quote->collectTotals();

Hope this helps!

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top