vickris
vickris

Reputation: 293

Spree prices based on weight

Is it possible to implement prices based on weight in spree commerce. My store will be selling vegetables and various types of meat. I want the customer to have an option of selecting weight e.g when buying beef one has the option of selecting the weight in kilograms and the price should adjust accordingly. Is this possible?

Upvotes: 3

Views: 667

Answers (2)

milind phirake
milind phirake

Reputation: 493

In Spree you can archive this by adding the weight in your option types. And you can create a variants like wise and each variant has it's different price. So, without any code change you can fulfill your requirement. e.g In you case you can create a beef as product with option type Weight. after this you can create a variant like 250 GM, 500 GM, 750 GM etc with different prices. Then on you product page customer can select the weight as option and price of you order will be calculated on the basis of the selected variant and quantity.

Upvotes: 2

NM Pennypacker
NM Pennypacker

Reputation: 6942

Instead of setting the price of a product's master variant based on weight, you should probably just create a bunch of variants from each master product that have different weights and allow the user to select the quantity. For example, if you have a product master called beef you would create variants for 1kg, 2kg, 5kg, and allow the user to select from the dropdown of predetermined weights. Spree is not configured to recalculate the price of a master product based on user input and it could get messy building an extension to accomplish that. I'd stick with different weights for product variants.

Upvotes: 0

Related Questions