- Edit the Reaction Rule "Collect rates: Flat Rate" and add conditions if you wish, so that it only applies to certain Product Types, or to an Order whose total is over a certain amount, for example. (Note that because you are using Conditional Rules you could also put such logic in the Action of your shipping pricing rule [see below])
- Create a Shipping Service for your Flat Rate Shipping Method. For example, "My Basic Shipping." Give it a base rate - can be $0, or whatever.
- Create a shipping pricing Rule that applies shipping charges to Products through the Service you just created. You can use conditionals in the Rule to apply the shipping based on SKU, Product Type, price, or whatever. You can use extra modules to base it on size and weight, day of the month, whatever.
Here's an example of a Price Calculation Rule. My Shipping Service is called 'swag shipping' and the Rule adds to the shipping cost based on the country:
{ "rules_ship_s_store_shipping_surcharge_by_country" : {
"LABEL" : "Ship\u0027s Store: Shipping Surcharge by Country",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "Commerce Checkout" ],
"REQUIRES" : [
"rules",
"commerce_order",
"rules_conditional",
"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" : "swag_shipping"
}
},
{ "entity_has_field" : {
"entity" : [ "commerce-line-item:order" ],
"field" : "commerce_customer_shipping"
}
},
{ "NOT commerce_order_compare_address" : {
"commerce_order" : [ "commerce-line-item:order" ],
"address_field" : "commerce_customer_shipping|commerce_customer_address",
"address_component" : "country",
"value" : "US"
}
}
],
"DO" : [
{ "CONDITIONAL" : [
{
"IF" : { "commerce_order_compare_address" : {
"commerce_order" : [ "commerce-line-item:order" ],
"address_field" : "commerce_customer_shipping|commerce_customer_address",
"address_component" : "country",
"operator" : "is one of",
"value" : "CA\u000D\u000AMX"
}
},
"DO" : [
{ "commerce_line_item_unit_price_amount" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : "1000",
"component_name" : "flat_rate_swag_shipping",
"round_mode" : "1"
}
}
]
},
{ "ELSE" : [
{ "commerce_line_item_unit_price_amount" : {
"commerce_line_item" : [ "commerce_line_item" ],
"amount" : "1500",
"component_name" : "flat_rate_swag_shipping",
"round_mode" : "1"
}
}
]
}
]
}
]
}
}
IMPORTANT NOTE: You may have trouble after you get your shipping working, to display your shipping line items in your Order display, for example in the Order acknowledgment e-mail that comes by default with Commerce. You need to make some rather complicated configuration changes to get this to work. Please see the article How to display all Drupal Commerce line items using a token if you get that far.