How Can We Help?

< All Topics

Instructional Template | Calculated Base/ Unit Price Method

This is an instructional template to demonstrate how to add a calculated base or unit price to your feed using the variables function within Feed Donkey.

This template neatly demonstrates how the creation of variables allows you to insert dynamic variables as you require into the builder function.

This is also a potentially very useful solution as at the moment, although base/ unit price can be created as a native field in Shopify stores with a locale of FR or DE – at present these fields are not available via API and therefore it is difficult to use them with feed builders.

The problem therefore is that stores can create additional meta data values – to house this value but of course this means that any change in price needs an additional revision to the base price value. As anybody who administrates a site knows – the more places that data needs to be revised, the more chance of it being out of date.

With this method you can be confident that your changes will flow through automatically.

There are other ways of arriving at the right number but the one we’re going to use here is that:

(Sale Price x 100) / Weight in grams = Base Price

So this is assuming that your unit of measure is 100g.

Now your stores requirement may be a little more simple than the example in that we are imagining a situation where a store has products where the weight value for some in in grams and for others is in kilograms.

Step 1

We make a variable for the (Sale Price x 100) part of the formula. We will use this in the next two variables.


So here we are using the FORMULA numeric function to transform this value. The ‘#’ character represents the source data value and we are multiplying by 100.

This variable can now be used in other places in shortcode form as ${PriceX100}. Plus it will be selectable in the pulldown for map column return values.

Step 2

So as described we have products where weight is represented as both grams and kilograms. So we are going to make two variables.

One assuming grams is the weight and the other assuming kilograms


Note: here it is important to FORMAT NUMBER to two decimal places before the FORMULA to prevent problems with rounding.

Step 3

So the only thing remaining is to show these two variables above against the right products.

To do this we are going to map their appearance dependant on the Variant_WeightUnit value.

In the column builder this will look like this:

As you can see this map rule is looking for a match on the weight unit value, then returning the appropriate $variable as part of a string.

Alternative Methods

As stated earlier this not the only method of calculation that will work by any means.

You could certainly employ the following formula just as successfully

Sale Price / (0.01 x Weight in Grams)

Firstly, create a variable that is simply the item weight in grams


Note: this calculated base/ unit price method is assuming a measure unit of 100g.