The calculation fields in Product Add-Ons Ultimate can pull a numeric value from one of your product’s global (taxonomy) attributes directly into a formula. This is useful you want a price to scale with something you’ve already defined as an attribute – e.g. a weight, length or size stored as pa_weight.
Syntax
Reference an attribute using its taxonomy slug wrapped in curly braces:
{pa_weight}
- The slug must match exactly as WooCommerce stores it — always lowercase and prefixed with
pa_(e.g.pa_weight,pa_colour,pa_length). You can find the exact slug under Products → Attributes in wp-admin. - This only works with global attributes (the ones managed under Products → Attributes and assigned via the product’s Attributes tab). Custom (per-product, non-global) attributes are not supported — a formula referencing one will not evaluate.
- Only the first value selected for that attribute on the product is used. If a product has multiple terms selected for the same attribute, any beyond the first are ignored.
- The attribute’s term is read as text and everything except digits and decimal points is stripped out. So a term labelled
2.5 kgbecomes2.5. A term labelledRedbecomes an empty value and will cause the formula to fail. Attribute terms used in formulas should be numeric (e.g.2.5,10,1.25), not descriptive text.
Combining attributes with other formula content
You can combine {pa_xxx} tags with other operators, fields, and variables, and you can use more than one attribute in the same formula. For example, these formulas are all valid:
{product_price} * {pa_weight}
{pa_length} * {pa_width} * {pa_height}
round( {pa_weight} * 2.5, 2 )
Other useful information
Note the following:
- There’s no autocomplete or insert button for attributes in the formula builder panel – you need to type the
{pa_slug}tag manually. - The formula syntax checker won’t warn you if the attribute doesn’t exist, isn’t numeric or isn’t a global attribute. If it’s wrong, the field will simply show an error or blank result on the front end. If a calculation field using an attribute isn’t working, double check:
- The attribute is a global attribute (not custom).
- The slug in
{pa_xxx}matches the attribute’s actual slug exactly. - The attribute’s selected term on this product is a plain number (or a number with non-numeric characters you’re OK being stripped, like “2.5 kg” → “2.5”).