<p>You could simply use variants to handle this couldn't you?  A non-name and named variant, each with a different price.</p>

<p>There's no other built in way to do what you want without PHP, I think.  The PHP would not be too complex though, if you fancy adventuring into Craft plugins, which are super-useful with Commerce in general, opening up all sorts of extra possibilities.</p>

CC BY-SA 3.0
2016-11-23T08:45:05.467Z
Yes and no. The trouble is with that is this scenario;

There's a set amount of covers for a pillow, but the stuffing can be two different choices. Basically build to order, but the amount of items is based on the amount of covers.
Anders
CC BY-SA 3.0
2016-11-23T09:25:38.820Z
Not fully following  perhaps, but with Multiadd you can perhaps build a form to deal with something like that- https://github.com/engram-design/MultiAdd
Jeremy Daalder
CC BY-SA 3.0
2016-11-23T06:22:25.693Z
2016-11-23T06:22:25.693Z
Jeremy Daalder
<p>Is there a way to modify a variant's price based on a custom field in the product? </p>

<p>To clarify, Let's say I have a matrix field with a block that has a text input with the handle <code>name</code> and a numeric input field with the handle <code>price</code>. This is then outputs as a radio button select list in the template like "Original" and "Name". When the "Name" radio button is selected, the price is picked up from the field <code>price</code> in that matrix block. The user could then add to cart with the modified price.</p>

<p>Any way to do this without plugins, or is there a plugin available for this logic? I'm not PHP savvy, so any light that can be shed on this is much appreciated. Ideally there's a way to do this within the template.</p>

<plugin-craftcommerce>
Modify/add to price based on custom field?
# Modify/add to price based on custom field?

(Asked by: username_0 on 2016-11-22)

Is there a way to modify a variant's price based on a custom field in the product?

To clarify, Let's say I have a matrix field with a block that has a text input with the handle `name` and a numeric input field with the handle `price`. This is then outputs as a radio button select list in the template like "Original" and "Name". When the "Name" radio button is selected, the price is picked up from the field `price` in that matrix block. The user could then add to cart with the modified price.

Any way to do this without plugins, or is there a plugin available for this logic? I'm not PHP savvy, so any light that can be shed on this is much appreciated. Ideally there's a way to do this within the template.

**Tags:** plugin-craftcommerce


---

## 1 answers

### Answer by username_1 on 2016-11-23. Score: 1

You could simply use variants to handle this couldn't you? A non-name and named variant, each with a different price.

There's no other built in way to do what you want without PHP, I think. The PHP would not be too complex though, if you fancy adventuring into Craft plugins, which are super-useful with Commerce in general, opening up all sorts of extra possibilities.

> **Comments:**
> **username_0**: Yes and no. The trouble is with that is this scenario;  There's a set amount of covers for a pillow, but the stuffing can be two different choices. Basically build to order, but the amount of items is based on the amount of covers.  
> **username_1**: Not fully following  perhaps, but with Multiadd you can perhaps build a form to deal with something like that- https://github.com/engram-design/MultiAdd  

---

