We have a drupalcommerce website through which we sale

  • iptv box
  • qwerty key board

on adding first product it adds 15 dollars( base rate ) + 5 dollars per item in cart, so if we have 1 item in cart the shipping is 20 dollar but if we have 2 products the shipping will be 25 dollars and so on.

problem is, we want to setup separate shipping rate for qwerty key board if there is only a qwerty key board alone in cart the shipping must be 5 dollars.

I hope this can be done through shipping rules

  • I am having a similar issue. Did you ever figure out how to calculate different shipping rates based on line item product type? Aug 31, 2017 at 12:16

2 Answers 2


You can add a shipping service dedicated for for qwerty key board and similar items and a shipping calculation that checks for a certain product in the cart. Use: Event: Calculating a shipping rate Condition: order contain a particular product. Action:Add a rate for a shipping service to an order and select the shipping service that is dedicated for qwerty key board and similar items.

It may be easier for you to clone one of the existing shipping rate calculation and edit as needed.

  • if order contains product A it adds 10 dollars to all items in the cart and if order contains product B, it adds another dollar 5 per product in shipping Dec 17, 2012 at 3:47
  • Try this method: drupalcommerce.org/videos/demo/… it utilizes a flat rate shipping for the base rate and calculation rules to add any amount to every item. You may need to have one calculation rule for every product type (+$5 and +$10). You will also have to provide a calculation for what happen if both products are in the cart.
    – ahimsauzi
    Dec 18, 2012 at 6:18
  • I have already seen that video, in-fact that is what I used to configure shipping rule which adds a dollar 5 to the base rate for each item added in the cart. But there is no clue to setup separate shipping rate for different product types. Dec 18, 2012 at 15:41
  • Is there a way we can loop action to line items of specific product types or sku. Dec 18, 2012 at 15:43
  • I would create a separate rule for each sku and run a loop through the line items(commerce-line-item:order:commerce-line-items) is condition is true.
    – ahimsauzi
    Dec 18, 2012 at 18:29

This video shows how to set up seperate shipping costs per line item http://www.youtube.com/watch?v=g3zQ3OMxUdQ&feature=youtu.be

  • Welcome to Drupal Answers! On this site it is generally considered bad habit to post link-only answers. Have a look at the help center to find out more about writing good answers. Please add some additional details that make your answer independant of the linked video.
    – berliner
    Mar 9, 2014 at 15:27
  • That video isn't available any longer. Can you please post steps or an updated link? Aug 31, 2017 at 12:16

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.