I have a variety of products that have different fixed shipping prices. Each product has a custom field associated with it that contains a decimal price for shipping. Using Flat Rate Shipping, on the event "Calculating a shipping rate", how may I go about bringing in the custom field (scoping) to calculate that shipping price?

1 Answer 1


It's probably easier to have multiple flat rates, and a conditional rule that the product for that price is in the cart.


  • There's a commerce shipping rules module that has a "cart contains item" condition.
  • If you could get at the logic behind the prices you could deal with this more easily, like weight based or size based shipping. For hundreds of products it's unreasonable that there's no logic behind it outside of what they want to charge for shipping. What I could think of is a custom module using hook_commerce shipping method alter where the shipping method matched the shipping price in the field. I've written a small module that alters the shipping weight, but that again assumes logic the weight based shipping.
  • Not a bad workaround--I'll give it a shot. Commented Mar 16, 2016 at 20:47
  • There's a commerce shipping rules module that has a "cart contains item" condition, I'd have posted more details but I'm posting in transit from my phone
    – nizz0k
    Commented Mar 16, 2016 at 20:50
  • If I added that type of rule, I'd have to do it for hundreds of products, and it would be tough for the client to change. It would be radically better to simply take a field from the product instead. Commented Mar 18, 2016 at 16:47
  • Just out curiosity, how are the shipping rates so different from product to product? What are the shipping rates based on?
    – nizz0k
    Commented Mar 18, 2016 at 16:57
  • I'm not actually sure. The client is shipping training materials, and is arbitrarily choosing shipping prices. Commented Mar 20, 2016 at 15:44

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.