The custom price calculator gives a powerful feature to use the Shopify metafields in your pricing formula within the Custom Price Calculator.

Let us explain by an example of a tile store. A tile store would want to create a calculator that takes length and width from the customer and calculates the total area (Square Feet or Square Metre), then display the number of tile boxes based on the area and the total price based on the number of tile boxes.

Let us assume that the tile store sells tiles of different colors and sizes. The boxes for different tiles may have different total square footage or square. To build a calculator for such products, you had to create a formula with a constant value for the total area (or the total square footage) as shown in the image below.



where "Length (m)" and "Width (m)" are the inputs provided by the customers, "Shopify_product_price" is a variable provided by our app to fetch the product price from Shopify (To know more, read our help article - Using Product Price in Formula ) and finally "50" is the constant value to represent the total area or square metre provided in the box for that product (type of tile)

The main issue with the above approach is that the total area (which is 50 in the above case) would vary from product to product in this case tile type to tile type. This will require creating a new calculator for each product leading to repetitive work of building multiple calculators of the same type.

For avoiding the above scenario, and using a single calculator for similar pricing logic, use our Metafield feature.

Shopify allows you to create metafields that can be assigned to different products and can have a different value for each product. In this case, we created a metafield called "total_area", and selected the metafield type as "integer" before saving it.



Update the metafield for all the tile products including "Moonlight Tiles" which is being used in this example. On the product page - "Moonlight Tiles" let us assume the total area to be 50 square metre, so update the value as "50"



Now, going back to the calculator in formula configuration. Now, you can use the variable "Shopify_Meta_(metafield name)" instead of using the constant value "50". This variable would read the different metafield value on different products allowing you to the same calculator for similar pricing logic.



Please note, when you type "Shopify" in the formula you can press the downward arrow ↓ key to arrive at the variable "Shopi_Meta_" after which you need to manually type the metafield name (in this case total_area) to complete the variable name - "Shopify_metafield_total_area"

Feel free to reach out to our support team if you face any trouble in using metafields in your calculators.
Was this article helpful?
Cancel
Thank you!