I am using Commerce 7.x-1.13 module on my website. I would like to calculate the shipping based on the order total. However, every time I refresh my checkout page, the shipping fee will be increased because the "order total" includes product price, tax, and shipping fee. Does anyone have any idea that I can calculate shipping only based on the product price?
Below is my shipping rule(if order subtotal<9, shipping=5% of subtotal; else shipping=9):
{ "rules_shipping_ground" : {
"LABEL" : "Ground",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [
"rules",
"rules_conditional",
"commerce_line_item",
"commerce_shipping"
],
"ON" : { "commerce_shipping_calculate_rate" : [] },
"IF" : [
{ "entity_has_field" : {
"entity" : [ "commerce-line-item" ],
"field" : "commerce_shipping_service"
}
},
{ "data_is" : {
"data" : [ "commerce-line-item:commerce-shipping-service" ],
"value" : "standard"
}
}
],
"DO" : [
{ "data_calc" : {
"USING" : {
"input_1" : [ "commerce-line-item:order:commerce-order-total:amount" ],
"op" : "*",
"input_2" : ".5"
},
"PROVIDE" : { "result" : { "5oftotal" : "5% of total" } }
}
},
{ "CONDITIONAL" : [
{
"IF" : { "data_is" : { "data" : [ "5oftotal" ], "op" : "\u003E", "value" : "900" } },
"DO" : [
{ "commerce_line_item_unit_price_amount" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : [ "5oftotal" ],
"component_name" : "flat_rate_standard",
"round_mode" : "1"
}
}
]
},
{ "ELSE" : [
{ "commerce_line_item_unit_price_amount" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : "900",
"component_name" : "flat_rate_standard",
"round_mode" : "1"
}
}
]
}
]
}
]
} }