I'm working with Drupal Commerce, and i have a node type called "travel" with a product entity. This product have some static fields types like "city" which are used to define different prices supplements depending the departure city (Aka NY (+$15 extra transport charge), L.A(+$25 extra transport charge), S.D (+$20 extra transport charge) etc.). These fields are static, that mean i don't have to jump too often in the Store options to add my cities. (But i can set the price in the node edition as it is an option set.)

But i have another field: Range date of Departure/Arrival, this field is dynamic, i may have to set custom entries for each added nodes.

In the example below, my node is a travel to London (base price of $1500). The departures are: Los Angeles (+$30 e.t.c), New York (+$50 e.t.c), San Diego (+$25 e.t.c). But in the node i have to set different sojourn range dates:

Available dates: -2014-01-20 to 2014-01-30 -2014-02-20 to 2014-02-30 -2014-03-20 to 2014-03-30 ...

Each of these dates directly alters the travel price. My wish is to set a different travel price per range date like this:

-2014-01-20 to 2014-01-30 ($1600) -2014-02-20 to 2014-02-30 ($1650) -2014-03-20 to 2014-03-30 ($1450)

OR A discount/extra charge to the main sojourn price ($1500) like this:

-2014-01-20 to 2014-01-30 (+$100) -2014-02-20 to 2014-02-30 (+$150) -2014-03-20 to 2014-03-30 (-$50)

Of course, those changes are not directly visible on the front-side, the visitor will just see "10 days of travel to London from 2014-03-20 to 2014-03-30 for $1450".

Now the technical problem is not really the front integration, but most likely the back-office configuration. Which product field configuration/combination should i use ? Remember that prices per dates should be set from the node creation form.

In the first approach, i was thinking about a multi-field field type combined with a sub-option set, but it seem that drupal did not appreciate that combination and doesn't recognize those fields as it mixes html id/classes like hell :/

So i'm now, my head in my hands, awaiting for a Drupal SuperHeroes.

Regards, Geo

2 Answers 2


If I understand what you're trying to do here correctly, you may need to create some custom Rules.

Event: Calculating sell price of product.

Conditions: This is where it gets tricky. If the date range is not on the product entity, you'll need a way to get the values from the product display node, that could be annoying in and of itself.
Now, if pricing for date ranges are statically calculated (ie: a 3 day trip ALWAYS adds $50), you could set up some custom code to dynamically do things like that.
On the flip side, if those range rates are different per product, it seems it would be necessary to define those on the product entity. And furthermore, you would probably need to create products for each variation (as in, variation for every combination of departure city AND date range).

Action: Add amount to product price (or something like that, I'm not looking at Rules directly).

  • You helped me a lot, after some weeks of desperate research it finally worked, not exactly like i wanted, but it's fine altough. Thanks!
    – Geolim4
    Feb 4, 2015 at 10:32

You should use Rules but you should install Conditional Rules. You can build as many layers of logic into the rule as you need.

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.