I made shipping $5 and $1 for every item added (so I set base shipping to $4). I followed this tutorial at https://commerceguys.com/blog/using-calculation-rules-add-item-shipping-...

Here is my rule:

{ "rules_add_1_to_each_item_for_shipping" : {
    "LABEL" : "Add $1 to each item for shipping",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "commerce_line_item", "commerce_shipping" ],
    "ON" : { "commerce_shipping_calculate_rate" : [] },
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "commerce-line-item:order:commerce-line-items" ] },
          "ITEM" : { "line_item" : "Line Item" },
          "DO" : [
            { "data_calc" : {
                "USING" : { "input_1" : [ "line-item:quantity" ], "op" : "*", "input_2" : "100" },
                "PROVIDE" : { "result" : { "calculated_line_item_shipping" : "Calculated Line Item Shipping" } }
              }
            },
            { "commerce_line_item_unit_price_add" : {
                "commerce_line_item" : [ "commerce_line_item" ],
                "amount" : [ "calculated-line-item-shipping" ],
                "component_name" : "flat_rate_standard_shipping",
                "round_mode" : "1"
              }
            }
          ]
        }
      }
    ]
  }
}

Shipping was calculated correctly before Coupon. I did noticed that whenever I added a coupon the shipping went up by $1 incorrectly! I believe this is because the rule I created counts line-items. I believe this is because coupons are added as line-items in actions unlike tax and shipping.

CommentFileSizeAuthor
without coupon.png27.93 KBstephenevans
with coupon.png33.57 KBstephenevans
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stephenevans’s picture

Issue summary: View changes