Which Rules Event can be used with Drupal Commerce when a cart is updated?

I have created a rule which add the shipping methods on cart page. It works fine when we add or delete the items from cart. BUT there is no event available on rules which fire when we increase the product quantity and update the cart.

I already used the event "After updating an existing commerce line item" but it is also not doing the job.

Here is my rule:

{ "rules_auto_add_shipping_service" : {     "LABEL" : "Auto-add shipping service",     "PLUGIN" : "reaction rule",     "OWNER" : "rules",     "REQUIRES" : [       "commerce_order",       "commerce_shipping",       "commerce_cart",       "commerce_rules_extra"     ],     "ON" : {       "commerce_cart_product_add" : [],       "commerce_cart_product_remove" : [],       "commerce_rules_extra_line_item_quantity_changed" : []     },     "IF" : [       { "commerce_order_compare_total_product_quantity" : {           "commerce_order" : [ "commerce_order" ],           "operator" : "\u003E=",           "value" : "1"         }       }     ],     "DO" : [       { "commerce_shipping_method_collect_rates" : {           "shipping_method_name" : "flat_rate",           "commerce_order" : [ "commerce-order" ]         }       },       { "commerce_shipping_rate_apply" : {           "commerce_order" : [ "commerce-order" ],           "shipping_service_name" : [ "" ]         }       }     ]   } } 

Replay

Make sure you have the Commerce rules extra module installed. This module will provide, among other things, the extra Rules Event "Quantity of line item has changed" (as described on its project page):

Line item quantity has changed (occurs when adding or removing a product to cart and when an amount has been modified in the cart form).

That should help to achieve your goal.

Category: 7 Time: 2016-07-30 Views: 4

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.138 (s). 12 q(s)