1

Drupal 7, Commerce

The Setup: A store with two products. They are a shippable item and a gift certificate.

The shippable item has a number of shipping options available.

Gift certificates have free shipping, and always go via first class mail.

I added a 'free shipping' shipping method. Unfortunately this always shows up in all checkouts, so someone could order a hundred shippable items and then select free shipping.

When I 'configure component' for the free shipping method, it lets me define a rule as to how this method is applied.

In this rule, I need to make a loop that goes through all line items, and if there are only products marked with a field called 'field_free_shipping', then show this method.

However.... Rules sucks. :-) I can make a loop, but then I can't ask it about the product node or the field.

What am I doing wrong? Any assistance appreciated.

I'll be adding a bounty to this question when it becomes eligible.

2

In such a simple scenario, where you only have two products, I would just use the condition Order contains a particular product to look for the shippable product to enable the paid shipping service. I'd then use the same condition negated to enable the free shipping service.

  • Came back to answer my own question to see an authoritative answer. We have like 5 shipping methods (intl, expedited, etc), so I had to conditionalize all of them against the free shipping product. A bit of tedium, and will have to change in 5 places with each new product. Commerce could do this better but I don't know how. Thanks. – paul-m Mar 28 '13 at 20:37
  • Ahh, if you have more shipping methods, then you can either manage them all individually like you have or else use a Rules component to define the condition set and just call the component from your various other Rules. That would let you maintain updates to the logic in a single place if, for example, you needed to add another free shipping product to the site. – Ryan Szrama Apr 1 '13 at 20:15
  • not understanding a module doesn't mean it sucks. Yes, it's opaque, but once you wrap your hear around it (like drupal itself, there are almost no limits) – nizz0k Dec 6 '15 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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