我想编写一个观察者函数,每当购物车总数都在变化时,该功能将发射。

Eg: When add/remove products in the cart, 
Add rewards/coupon codes to the cart

我的观察者功能将检查购物车总数是否大于零。如果没有,它将对总数进行一些计算,并将计算值保存到报价中。

我尝试了以下事件。但是他们中的未达到要求。

    controller_action_postdispatch_checkout_cart_index
sales_quote_address_collect_totals_before

任何建议将不胜感激。提前致谢。

有帮助吗?

解决方案

以下事件可以解决问题。

controller_action_predispatch_checkout_cart_index
许可以下: CC-BY-SA归因
scroll top