1

I need help with rules to set shipping rate depending on weight and address, I have some rules but can't do work properly, shipping rate load but there is no change with different weight, can anyone help me?

Thanks in advance!

My rules looks like this, only change in each rule is the "Province" and the limits weight.

{ "rules_atacama" : {
"LABEL" : "Atacama",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [
  "rules",
  "commerce_physical",
  "commerce_order",
  "commerce_line_item",
  "commerce_shipping"
],
"ON" : { "commerce_shipping_calculate_rate" : [] },
"IF" : [
  { "data_is" : { "data" : [ "commerce-line-item:type" ], "value" : "shipping" } },
  { "data_is" : {
      "data" : [ "commerce-line-item:commerce-shipping-service" ],
      "value" : "costos_envio"
    }
  },
  { "OR" : [
      { "commerce_physical_rules_order_weight_comparison" : {
          "commerce_order" : [ "commerce-line-item:order" ],
          "operator" : "\u003E=",
          "value" : "0",
          "unit" : "g"
        }
      },
      { "commerce_physical_rules_order_weight_comparison" : {
          "commerce_order" : [ "commerce-line-item:order" ],
          "operator" : "\u003C",
          "value" : "1500",
          "unit" : "g"
        }
      }
    ]
  },
  { "entity_has_field" : {
      "entity" : [ "commerce-line-item:order" ],
      "field" : "commerce_customer_shipping"
    }
  },
  { "OR" : [
      { "commerce_order_compare_address" : {
          "commerce_order" : [ "commerce-line-item:order" ],
          "address_field" : "commerce_customer_shipping|commerce_customer_address",
          "address_component" : "administrative_area",
          "value" : "AT"
        }
      }
    ]
  }
],
"DO" : [
  { "commerce_line_item_unit_price_amount" : {
      "commerce_line_item" : [ "commerce_line_item" ],
      "amount" : "3350",
      "component_name" : "flat_rate_costos_envio",
      "round_mode" : "0"
    }
  }
]

} }

1

If you're taking the pure rules route, you'll need a single rule per rate. So if you have two (2) zones and three (3) weight tiers, you'll need six (6) total rules. For example:

  1. Northeast
  2. Rest of the US

And

  1. 0-5 lbs
  2. 6-10 lbs
  3. 11+ lbs

Will be 6 total rules:

  1. Northeast (0-5 lbs)
  2. Northeast (6-10 lbs)
  3. Northeast (11+ lbs)
  4. Rest of the US (0-5 lbs)
  5. Rest of the US (6-10 lbs)
  6. Rest of the US (11+ lbs)

You may also find it worth your time to review Commerce Shipping Postal Code Weight and Commerce Shipping Weight Tariff.

|improve this answer|||||
  • thanks! I prefer the rules, I have a lot of modules and am trying to not install more I have one rule for each weight and province, but I have 2 problems: 1. If I choose any product always show me the same price for the same Province, no change when the weight is different, I have 4 rules, two for the same Province, one for 0 to 1500 grs and other to 1501 to 3000, the province selection works fine, just need to correctly set the weight. 2. I need a rule or loop that can take 2 or more products and make shipping by total weight of the order. Can you give some clues? thanks in advance – Machelat Dec 29 '15 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.