1

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.

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.

| improve this answer | |
  • 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 Nov 23 '16 at 8:45
  • Not fully following perhaps, but with Multiadd you can perhaps build a form to deal with something like that- github.com/engram-design/MultiAdd – Jeremy Daalder Nov 23 '16 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.