In the post “How to add prices for particular attributes” you can learn the basics of setting up additional prices for attribute items. In this post we will focus on setting up advanced pricing rules for attributes and inputs. This is a PRO feature, so you need to have a valid license before you continue. Field calculation labels Before we cover the calculation options, we need you to understand which values you can enter in the calculation fields to get the right formula or table result. Formula and table calculations are based on attribute titles, attribute item labels or attribute field keys. But when should you use which value? We will make it clear with a few scenario’s Note: By attribute title we mean the field attribute title, not the attribute post title. See image below.
Atribute price key location You can find attribute price key in attribute page in the “Presentation” tab Since version 2.3 the fields have been moved to separate tab: “Advanced calculation”
Attribute item field key location You can find attribute item field key in attribute items repeater. Make sure your attribute type is set to Input.
Key instead of labels If you have entered a field key for the attribute input item or price key for the main attribute, always use the key for the calculation. If no field key is set, you can use the attribute item label or attribute title. Attribute title instead of item label If you have set the calculation of the attribute to default calculation, you can use the attribute item field keys (or labels) for calculations. When you have set the attribute calculation to formula, matrix, or matrix-formula, use the attribute price key (or title) instead, for the total attribute now contains a single price value. Expected label format You should enter the URL-friendly format of the title of the attribute, or the label of the attribute item (for attribute input items). For field keys you can copy the exact value, but make sure the field key is URL friendly (no spaces; letters only) Example formula: field-length * table-width / 120 Get input value instead of input price By default we take the unit or fixed price result of the input to use in the formula when you enter the field label. Let’s say you have fixed price of 20. Then field-length equals 20 in the formula. If you want to use the input value instead of input price, simply append ‘_value’ after your label. Result: field-length_value * table-width_value / 120 TablePress At the moment we only support pricing tables of TablePress, a well-known plugin for creating tables in WordPress. We support two types of tables: range price tables and matrix price tables. Range tables can only be selected in attribute item table prices, for the price in the table is based on a single value. Matrix tables can only be used for attribute calculations, because the price depends on two inputs. Range tables
The attribute item has type input, which has a numeric value. The pricing for the numeric value can be between two numbers. In order to achieve this, you need a price range table with minimum and maximum slots (marked red and green). When value A is between 1 and 10, use price of $1.10. When value A is between 11 and 20, use price of $1.20. And so on. Notes: The numbers should match the input values based on the given units. The pricing table should contain all numbers between the minimum input value and the maximum input value. Matrix tables
Matrix tables work a bit different. In matrix tables you have two input values. Therefore you cannot link a matrix table to a single attribute item. In this case we have value A and B, which will be the horizontal (marked as green) and vertical (marked as red) input values respectively. The value cell is calculated as current input value between current cell and next cell. A few examples based on the matrix above: Given value A = 80 and input value B = 240, the price is 1.6. Given value A = 75 and value B = 240, the price is 1.5 Given value A = 75 and value B = 230, the price is 1.3 Advanced attribute pricing You can use these tables in the attribute pricing. Either in attribute item itself (use range table format) or in the main attribute settings (use matrix table). If you want to apply range table to attribute items, you should read this article. We will only cover the main attribute price options here: Default calculation Formula Matrix Formula + Matrix You can find the settings for attribute prices in the “Presentation” tab of the attribute. Since version 2.3 you can find this in the “Advanced calculation” tab. 1) Default calculation Default calculation will follow the attribute item prices. Every selected attribute item cost will be added to the total price. 2) Formula price
To create formula price, simply select Formula option in Price type field. Next, enter the desired formula in the Formula field. The total price of the attribute will be the evaluation of the given formula. You can enter anything mathematic, like ( A + B ) – ( C * D ), as long as it follows the rules for proper maths (no division by zero, etc.) So you should be careful at allowing “0” as a valid input value, because that might get you into some trouble. The letters A, B, C and D are referring to the given field keys. You can enter any field key you like, as long as they match and don’t contain spaces, you should be fine You can optionally set price key if you wish to use this calculated attribute value elsewhere. But you can also just use the field labels in the formula. The price label will be shown above or below the attribute field with the calculated attribute price value. If price display is not set to hidden. 3) Matrix table price In order to use a matrix table in a measurement field, you have to choose a matrix table and define the input keys (see section field calculation labels) of the inputs you want to pull the values from. First, set Price type to Matrix (or Matrix + formula)
Next, select the matrix table and configure the options: Table type: whether to perform simple price lookup (most common), price lookup and multiply by entered values or multiply by total value Table rounding: round values up or down based on given value (will result in higher or lower price on edge cases). Given the matrix table example, 61 will get value from column ’70’ when rounding up. When rounding down, 61 will get values from ’60’. Table range: return first / last value inside the range, or return false (no price) if value is out of bounds Minimum extra price: minimum price to charge when no value or very low value is entered. In the example above I have entered field keys ‘A’ and ‘B’ for input value X and Y. These keys should match the “Field key” setting for the attribute input field. See image below. Attribute item label works too.
4) Matrix + formula price Finally, we have the most advanced option: combination of matrix table price lookup and formula value. First, the system will look up the matrix table price based on the given settings. Next, the value will be placed inside the formula. Finally, when all parameters are present, the formula price for the attribute will be calculated. Let’s say the attribute has title “Input measurements” Then the formula could be: input-measurements * A * 1.85 input-measurements will be the price from the matrix table. Note: the minimum extra price is for the table only. Not for the formula result.