I have some products type , I want when a specify product type is in order add amount to shipping cost. my idea was create a rule with condition Order contains products of particular product types ,and select action add a amount to unit price but in item identifier * Specify an identifier of a commerce Line item section I try everything but returned me error.

I try commerce-order:commerce-line-items: and commerce-order:commerce-line-items:0,commerce-order:commerce-line-items:1 ,commerce-order:commerce-order-total:

but all of them return me Data selector commerce-order:commerce-line-items: for parameter commerce_line_item is invalid. error.

what I should input there ? is my idea correct way to add amount to shipping price when specify products are in order?

2 Answers 2


You're probably wanting the basic solution explained in this video: https://commerceguys.com/blog/using-calculation-rules-add-item-shipping-commerce-shipping-screencast

With a little modification, it looks like this:

  1. Add a new "Calculation rule" for your shipping service.
  2. Add an action loop that loops through the line items in the order.
  3. Add an action "Calculate a value" and multiply the quantity times a field which holds the shipping price you want to charge for that item and store it in a named variable.
  4. Add an action "Add an amount to the unit price" that adds the named variable to the unit price of the shipping line item.
  • Using the Commerce Flat Rate module to create a rate for each product. How would I then create another shipping service with the value calculated from the commerce_shipping_price field?
    – IamOnStage
    Commented Sep 13, 2017 at 15:56

Why not just use the Commerce Flat Rate module to add a flat rate to each item. You can also specify a standard rate for the first item, and an additional cost per extra item.

  • 1
    I have this module install, I want to specify product has specified flat rate .
    – Yuseferi
    Commented Feb 7, 2014 at 0:35

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.