Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited tags
Link
GiorgosK
  • 8.5k
  • 1
  • 42
  • 55
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Source Link

Pricing changes based on line item fields in the add to cart form

I've been using commerce_custom_product to add custom line items options to products I'm selling in the shop. The shop is selling servers and if someone when adding a server to their cart wants a bigger hard drive for instance they select it in the "add to cart" form. I want to alter the price of the line item based on which option they select

e.g.

20gb HDD $40 40 gb HDD $70

The hard drives and other things are not really properties of the product I'm buying. They are options I'm selecting for the product. This is why I looked at commerce_custom_product.

Ultimately this question comes down to How can I set the product price based on choices made in the Add to Cart form. Is commerce_custom_product the way forward with something else bolted in? I'm very happy to code if there is a hook I could use to grab the price from the referenced entity if I was to add price to the entities that get selected in the add to cart form