<p>1oz = $1 ∴ 10oz = $10</p>

<p>Sell in units of weight as the quantity of the item.</p>

CC BY-SA 3.0
2016-05-30T09:44:25.040Z
Hi Steve, thanks. That seems to be a way to go about it, i'm going to check it out.
Bob Donderwinkel
CC BY-SA 3.0
2016-05-24T16:07:54.460Z
2016-05-24T16:07:54.460Z
Steve Adams
<p><strong>UPDATE</strong>: A new <a href="https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem" rel="nofollow">onPopulateLineItem event</a> was added to Craft Commerce to enable this exact use case of modifying an items price when added to a users basket. You could use it to get the items weight and multiply it by a value.</p>

<hr>

<p>I'm not sure what kind of product model you have to want to do this but a possible solution you might want to look at is charging shipping rates based on a products weight. </p>

<p>You can set up a Shipping Method with a rule that uses the weight of an item multiplied by a <a href="https://craftcommerce.com/docs/shipping-methods#getweightrate" rel="nofollow">Weight Rate</a>. </p>

CC BY-SA 3.0
2016-05-30T09:40:24.020Z
Hi Luke, thanks. I checked out the getWeightRate(),am i right that this is only available through a cart and not through a product model (or as individual 'shipping' model). I need to be able to use it in a product page to show the buyer a eventual price before actually ordering it..
Bob Donderwinkel
CC BY-SA 3.0
2016-06-13T16:06:19.720Z
Updated original answer to include information about a new event that could help you.
Luke Pearce
CC BY-SA 3.0
2016-05-24T16:17:04.940Z
2016-06-13T16:05:07.417Z
2016-06-13T16:05:07.417Z
Luke Pearce
<p>I'm trying out the Craft Commerce plugin, and i'd like be able to let users order products with a custom price based on a choosen weight.</p>

<p>The price is now fixed to what you choose in the control panel, and there seems to be no easy way around that, but perhaps i'm wrong.</p>

<p>Is this possible? It's pretty crucial feature i need, so any help is appreciated :)</p>

<p>Cheers, Bob</p>

CC BY-SA 3.0
2016-05-24T22:55:23.380Z
Can you flesh the question out a little more Bob - is the price a fixed cost per weight unit (in which case Steve's solution below should work well)?  Or is it more complex than that?  A simple plugin could do more complex thing by listening to https://craftcommerce.com/docs/events-reference#commerce_lineitems.oncreatelineitem  for example..
Jeremy Daalder
CC BY-SA 3.0
2016-05-30T09:37:08.793Z
Hi Jeremy, thanks. The price is a fixed cost per weight, but as far as i can check that info, getWeightRate(), is only available in a cart and not through a product model? But perhaps i'm wrong there.
Bob Donderwinkel
<ecommerce>
Craft Commerce, variable product prices based on weight. Is this possible?
# Craft Commerce, variable product prices based on weight. Is this possible?

(Asked by: username_0 on 2016-05-24)

I'm trying out the Craft Commerce plugin, and i'd like be able to let users order products with a custom price based on a choosen weight.

The price is now fixed to what you choose in the control panel, and there seems to be no easy way around that, but perhaps i'm wrong.

Is this possible? It's pretty crucial feature i need, so any help is appreciated :)

Cheers, Bob

**Tags:** ecommerce
> **Comments:**
> **username_1**: Can you flesh the question out a little more Bob - is the price a fixed cost per weight unit (in which case Steve's solution below should work well)?  Or is it more complex than that?  A simple plugin could do more complex thing by listening to https://craftcommerce.com/docs/events-reference#commerce_lineitems.oncreatelineitem  for example..  
> **username_0**: Hi Jeremy, thanks. The price is a fixed cost per weight, but as far as i can check that info, getWeightRate(), is only available in a cart and not through a product model? But perhaps i'm wrong there.  

---

## 2 answers

### Answer by username_2 on 2016-05-24. Score: 2

1oz = $1 ∴ 10oz = $10

Sell in units of weight as the quantity of the item.

> **Comments:**
> **username_0**: Hi Steve, thanks. That seems to be a way to go about it, i'm going to check it out.  

---

### Answer by username_3 on 2016-05-24. Score: 1

**UPDATE**: A new [onPopulateLineItem event](https://craftcommerce.com/docs/events-reference#commerce_lineitems.onpopulatelineitem) was added to Craft Commerce to enable this exact use case of modifying an items price when added to a users basket. You could use it to get the items weight and multiply it by a value.

---

I'm not sure what kind of product model you have to want to do this but a possible solution you might want to look at is charging shipping rates based on a products weight.

You can set up a Shipping Method with a rule that uses the weight of an item multiplied by a [Weight Rate](https://craftcommerce.com/docs/shipping-methods#getweightrate).

> **Comments:**
> **username_0**: Hi Luke, thanks. I checked out the getWeightRate(),am i right that this is only available through a cart and not through a product model (or as individual 'shipping' model). I need to be able to use it in a product page to show the buyer a eventual price before actually ordering it..  
> **username_3**: Updated original answer to include information about a new event that could help you.  

---

