less than a minute read • Updated 20 minutes ago
Modify price, weight, code, or category with option modifiers
How to use option modifiers to adjust a product's price, weight, code, or category based on the option a customer selects.
Option modifiers let you adjust a product’s price, weight, code, or category based on the option a customer selects. Modifiers are added directly to option values using curly braces {} — no extra parameters required.
How to set it up
Add a modifier to an option value by appending it in curly braces:
<select name="size">
<option value="Small">Small</option>
<option value="Medium">Medium</option>
<option value="Large{p+2.00}">Large</option>
</select>
When a customer selects “Large”, $2.00 is added to the product price.
Modifier syntax
Modifier | What it modifies | Example |
|---|---|---|
| Price |
|
| Weight |
|
| Code |
|
| Category |
|
Each modifier supports three operations:
+— adds to the existing value-— subtracts from the existing value:— sets the value directly
Chaining multiple modifiers
Multiple modifiers can be chained together using the pipe symbol |:
<select name="size">
<option value="Small{p-2.00|w-1}">Small</option>
<option value="Medium">Medium</option>
<option value="Large{p+2.00|w+1}">Large</option>
</select>
Notes
Modifiers cannot be applied to standard product parameters (
name,price,code, etc.) directly — they must be applied through a custom option value.For code modifiers, the
codeinput must appear before the option that modifies it in your form.For multicurrency stores, append the currency code to price modifiers where needed, e.g.
{p+5CAD}. If no currency code is specified, the store currency is assumed.When using cart validation, set initial values high and modify down rather than the other way around — see the Foxy HMAC validation documentation for details.
The category modifier
{y:}is useful for donation forms that offer both one-time and recurring options, switching the product to a subscription category based on the customer’s selection.