spree / spree

An open source eCommerce platform giving you full control and customizability. Modular and API-first. Build any eCommerce solution that your business requires. Developed by @vendo-dev
https://spreecommerce.org
Other
12.85k stars 4.93k forks source link

Price per unit #9346

Open nut707 opened 5 years ago

nut707 commented 5 years ago

I want to provide price per unit for some type of products.

For example: I sell a lot of contructing stuff in my shop. Let's take laminate for this example. I want to specify price for one square meter of it. So 1 m^2 of laminate costs 10$. This price i want to set manualy. In laminate pack there is fixed amount of laminate, for example, 2.5 m^2. I will set it mannualy too. So price per pack will be calculated as 25$. It will set automatically. User must see price per unit - 10$/m^2, price per pack - 25$ and can buy only packs.

Is there any exsistent way or plugin to do it in spree? Or any best practise to do it elegant and dry?

Sorrry if i choose wrong place for such question)

MatthewKennedy commented 5 years ago

Have you tried creating product variants?

nut707 commented 5 years ago

@MatthewKennedy yep, this is not what i need.

maikis commented 5 years ago

Hey @nut707 @MatthewKennedy @damianlegawiec does anyone is working on this one? Is this feature confirmed? I would be more than happy to help you with this (or another) issue on my free time.

nut707 commented 5 years ago

@makis I've done own pretty simple and straight implementation in my project. But it will be great to implement this as feature of spree or as extension.

jasonfb commented 5 years ago

@nut707 -- if you want to share your code, perhaps we can open source it to make it into an extension?

I'm curious about how to store the non-standard quantity information back to the database, or if you over-loaded the LineItem#update method directly?

I started a discussion regarding this here https://github.com/spree/spree/issues/9420 with some concrete proposals. I assume based on the language you used above ("2.5 m^2") you are talking about something akin to square or cubic measurements, which are in line with what I am proposing above.