Vote up!
Vote down!

adjust variation price based on the next variation

Is there a way to adjust the variation price base on the first or second variation selected?
For example I have 3 variations. Size, material, color.
So if i choose small (that cost $5) and then material that is $10 ($15 total), then when i choose Large at $12, the material should cost $20.

I guess maybe something with Rules, but its not apparent? Or is it built in? Anyone done this?

Asked by: petergus
on April 26, 2013

1 Answer

Vote up!
Vote down!

I think you have to add a variation for each combination. I'd love to be wrong.

Answer by: abiconsulting
Posted: Apr 26, 2013


Yes. In Commerce, we treat all price points as one type of "thing." So even if you think of your product as configurable, Commerce will want to think of your products as specific SKUs with hard price points. For your example, each type of variation in size, color, etc, will result in a unique SKU representing that "configuration." The thing is, this scales on the backend very well, but for the store administrator, that seems a bit daunting. There are tools that help with this, though.

- Josh Miller on April 29, 2013

ok, i understand the point of each variation being its own 'thing', and that’s fine because it is a physical product. What i am stuck at is updating the variation based on another that is selected.


Selling beds and bed covers.
We have Twin, queen, etc.
the price of the covers depends on the size of the mattress.

so on a product display, someone selects queen, the Covers select list price should (magically ajaxly) update.

That is the idea situation and something i have seen existing on anther platform.

Is there another way to do 'thinking outside the box' that i havnt come to yet??

- petergus on May 1, 2013

To do that ... you create the following kinds of variations:

Product 1: King Size, Quality of Fabric, Price
Product 2: Queen Size, Quality of Fabric, Price
Product 3: ...

Each variation would have two taxonomy fields. One for "Size" and one for "quality" or whatever else differentiates your products. Then your add to cart form will create a drop down configurable form.

- Josh Miller on May 3, 2013

wow, ya that was it. just need a few days to wrap my head around, in true drupal fashion with several aha moments :) Thanks for pointing me in the right direction!

- petergus on May 4, 2013

Yeah, basically what you're looking for is exactly how it works. For a clear example, you can look at this page on the demo store and try changing both the color and the size. The SKU above the product price will change based on the options selected, and you could set any alternate price for the SKU you wanted (in this case they're just all the same price). It's all in how you create your product type, and for that there's documentation here on DC.org.

- Ryan Szrama on May 4, 2013