2

I'm trying to set a custom shipping amount to my cart under a specific condition. (My [lovely] client wants to skip the normal shipping rules).

How could this be done in the cleanest way possible?

Currently I'm hooking to sales_quote_address_collect_totals_after and doing the following:

$quote_address = $observer->getEvent()->getQuoteAddress();
$quote_address->setShippingAmount($shipping_price);
$quote_address->setBaseShippingAmount($shipping_price);
$quote_address->setGrandTotal($quote_address->getGrandTotal() + $shipping_price);
$quote_address->setBaseGrandTotal($quote_address->getBaseGrandTotal() + $shipping_price);

Whilst the shipping amount looks good, I am getting the custom shipping amount added 3 times to the grand total. I've also noted that sales_quote_address_collect_totals_after is triggered 3 times as well.

How could I go about this?

1

0

Browse other questions tagged or ask your own question.