Introduction
Have you ever needed to calculate your product price based on existing fields already set up and populated? StoreAutomator makes this - and similar tasks - possible through the use of dynamic custom fields. This article explores how to leverage dynamic custom fields to perform intermediary calculations and display the results using a formula.
How It Works
The flowchart below illustrates how dynamic custom fields work in practice.
Green = SA fields: cost, isfba
Yellow = formula
Blue = custom fields: basemark_up, shipping_cost, commission_rate
Blue boxes represent 3 custom fields: basemark_up, shipping_cost and commission_rate
- Green boxes represent the StoreAutomator fields that must be created and contain valid values: cost and isfba
- Yellow boxes represent 3 formulas/calculations
- The orange diamond is a logic case statement that will determine which path it follows
The calculation of price can be determined by using the following formula in the Default Field value (see image below). To be clear, we use the dynamic custom field formula below instead of a numerical value.
eval:{Product.Cost.Multiply({Product.CustomFields[base_markup]}).Add({If({Product.IsFba},{Product.CustomFields[commission_rate]},{Product.CustomFields[shipping_cost]})})}
You will notice that the dynamic custom field is defined by the use of “eval:” and the formula goes in the {curly braces}.
When writing a formula this utilizes the StoreAutomator Template function syntax, which is very specific. Please refer to this article for more information on function syntax.
This syntax sets this custom field as dynamic and this field value will be the result of the formula. You can see if a product’s price was the result of a dynamic custom field from the Product Editor page - as shown in the picture below.
Other Use Cases:
You can also write formulas to:
- Edit strings of titles of products or descriptions, especially for Ebay as there is an 80 character limit, a formula can correctly format the titles to adhere to ebay title limit.
- Formulaically determine channel-based MSRP