Show Shipping cost in checkout page not in cart page
-
11-01-2021 - |
Вопрос
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.
Решение 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
Другие советы
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!
Не связан с magento.stackexchange