rule to remove items from Shopping cart I am having difficulty creating a rule to completely remove items from a Shopping cart.
I have tried Before adding a product to the cart

{ "rules_prevent_salon_professional_xover" : {
    "LABEL" : "Prevent Salon professional xover",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "-18",
    "OWNER" : "rules",
    "TAGS" : [ "staffmy" ],
    "REQUIRES" : [ "rules", "commerce_order", "commerce_cart" ],
    "ON" : { "commerce_cart_product_prepare" : [] },
    "IF" : [
      { "data_is" : {
          "data" : [ "commerce-product" ],
          "op" : "IN",
          "value" : { "value" : [ "97", "98", "99", "100" ] }
        }
      },
      { "AND" : [] },
      { "data_is" : { "data" : [ "site:current-user:roles:5" ], "value" : "5" } },
      { "AND" : [
          { "NOT data_is" : { "data" : [ "site:current-user:roles:0" ], "value" : "1" } },
          { "OR" : [] },
          { "NOT data_is" : { "data" : [ "site:current-user:roles:4" ], "value" : "4" } }
        ]
      }
    ],
    "DO" : [
      { "commerce_order_update_state" : { "commerce_order" : [ "commerce_order" ], "order_state" : "canceled" } }
    ]
  }
}


as well as After adding a product to the cart

{ "rules_prevent_professional_subscription_purchase_cross_over" : {
    "LABEL" : "Prevent Salon professional subscription purchase cross-over",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "-18",
    "ACTIVE" : false,
    "OWNER" : "rules",
    "TAGS" : [ "staffmy" ],
    "REQUIRES" : [ "inline_conditions", "rules", "commerce_order", "commerce_cart" ],
    "ON" : { "commerce_cart_product_add" : [] },
    "IF" : [
      { "commerce_product_contains_products" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "sku" : "salon-owner-monthly , salon-owner-3month , salon-owner-6month, salon-owner-yearly "
        }
      },
      { "AND" : [] },
      { "data_is" : { "data" : [ "site:current-user:roles:5" ], "value" : "5" } },
      { "AND" : [
          { "NOT data_is" : { "data" : [ "site:current-user:roles:0" ], "value" : "1" } },
          { "OR" : [] },
          { "NOT data_is" : { "data" : [ "site:current-user:roles:4" ], "value" : "4" } }
        ]
      }
    ],
    "DO" : [
      { "data_set" : { "data" : [ "commerce-line-item:commerce-unit-price:amount" ] } },
      { "commerce_order_update_state" : { "commerce_order" : [ "commerce_order" ], "order_state" : "canceled" } }
    ]
  }
}


I tried modifying it, by Removing entity - but still have a product in the Shopping cart

{ "rules_prevent_salon_professional_xover" : {
    "LABEL" : "Prevent Salon professional xover",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "-10",
    "OWNER" : "rules",
    "TAGS" : [ "staffmy" ],
    "REQUIRES" : [ "rules", "commerce_order", "commerce_cart" ],
    "ON" : { "commerce_cart_product_prepare" : [], "commerce_cart_product_add" : [] },
    "IF" : [
      { "data_is" : {
          "data" : [ "commerce-product" ],
          "op" : "IN",
          "value" : { "value" : [ "97", "98", "99", "100" ] }
        }
      },
      { "AND" : [] },
      { "data_is" : { "data" : [ "site:current-user:roles:5" ], "value" : "5" } },
      { "AND" : [
          { "NOT data_is" : { "data" : [ "site:current-user:roles:0" ], "value" : "1" } },
          { "OR" : [] },
          { "NOT data_is" : { "data" : [ "site:current-user:roles:4" ], "value" : "4" } }
        ]
      }
    ],
    "DO" : [
      { "commerce_order_update_state" : { "commerce_order" : [ "commerce_order" ], "order_state" : "canceled" } },
      { "entity_delete" : { "data" : [ "site:current-cart-order" ] } }
    ]
  }
}


This Rule does prevent the role from being added to the user, but the product and its normal product price exists in Shopping cart on the Orders page.
I have created a rule that empty cart before adding any new item. So the only latest item will be in the cart. I think thats what you need to do. Any other conditions can be added one by one.

If you want to clear cart totally then you can use after adding product event

{ "rules_empty_cart_" : {
    "LABEL" : "Empty cart ",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "commerce_cart", "rules" ],
    "ON" : { "commerce_cart_product_prepare" : [] },
    "DO" : [
      { "commerce_cart_empty" : { "commerce_order" : [ "commerce_order" ] } },
      { "drupal_message" : { "message" : "Cart empty event executed.!!" } }
    ]
  }
}


Hope it will help!