I am using Drupal Commerce with Commerce Flat Rate and I have setup various different rates depending on the total order amount.

The normal use case works as expected, however if I am at the shipping checkout pane and I hit go back,hit continue, and then arrive again at the shipping pane again, the shipping amount is recalculated based on the previously calculated (order_total + shipping_cost), not on the original order_total if you know what I mean.

What hook and code should I use to remedy this so that the shipping cost is based on the original order_total the second time around like it was the first time around?

Is it possible to remove the shipping component of the order total on the first checkout page?

Should I try to detect when I am on the first checkout page whether I arrived from the shipping pane, and so try to remove the shipping price component from the order total?

1 Answer 1


Check out Per Product Shipping Buggy

Import this rule or a variant of it and adapt it to your use case:

{ "commerce_shipping_service_free_shipping" : {
"LABEL" : "Rate Free shipping",
"PLUGIN" : "rule",
"OWNER" : "rules",
"REQUIRES" : [ "commerce_shipping" ],
"USES VARIABLES" : { "commerce_order" : { "label" : "Order", "type" : "commerce_order" } },
"DO" : [
{ "commerce_shipping_delete_shipping_line_items" : { "commerce_order" : [ "commerce_order" ] } },
{ "commerce_shipping_service_rate_order" : {
"shipping_service_name" : "free_shipping",
"commerce_order" : [ "commerce-order" ]
  • The bit I was missing was the fact I needed to apply action 'Delete all shipping line items for an order' before applying the 'Add a rate for a shipping service to an order' Jul 16, 2014 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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