< All Topics
Print

The Variables Tab in Builder 🪄

Its been a busy few months at the stables 🐴 .. we have rolled out some great new features from new feed output formats (.json and .tsv), to live/ real-time feed updates.

We are pleased to announce a flexible and poweful new feature available to all our customers & this is the biggest news so far 📢. You will see an extra tab ‘Variables’ in the column builder section.

This grants you more options and methods to achieve exactly the output that you need.

The Variables Function

Let me give an example of the sort of scenario that can now be covered with this feature.

  • You are using a cart/ checkout ‘script’ to apply a 15% sale discount to a selection of your clearance products.
  • For the sake of simplicity, lets say these products are identified by a product level tag ‘sale-tier-15’
  • But by using this method – the original sale price in Shopify is untouched. So you need a way of showing this adjusted price selectively.

Within the Variables tab, you can construct – transformed data variables – that then can be used within the builder. So for example above you might build the following variables.

So just taking ‘Sale_Price_15’, this variable data, is the original selling price, reduced by 15%.

We have also created an ‘Undiscounted_Price’ variable so we can attach this to products where we know that a sale discount does not apply.

Usage in the Columns builder might look something like this

This would deliver the discounted price where the product has the sale tier tag against it – and the original selling price for everything else. This is a very simple example – of course you could add mulitple tiers based on multiple conditions if this was the requirement.

In the above example you will see that the ‘Value’ and ‘Default’ inputs now are a pull down selection. The Variables you have created will show as options to return, plus Custom, where you can type static value (or leave blank) depending on the requirement.

In the Custom selection box you can also use the variable in its shortcode form – and use this to make a variable string. For example, something like this

This variable shortcode ${Sale_Price_15} can be used for several other purposes too – to inject variable data into:

  • a STATIC column
  • The FIND and replace function

  • The REGEX REPLACE function

This is a single example there are lots and lots of others where this is potentially useful. For certain European trading zones, Unit Price is a mandatory requirement, but because these fields are not easily exported from Shopify, this could turn into a problem.

With this variable function no longer – we can calculate this from standard weight and price fields.

These are a couple of practical examples, but the potentials list is vast.

With variables creation, we have removed limitations, for example we can do actions such as extract number values from a string and then use this to perform additional number transformations.

So if we went back to the sale tags example. Say instead of a single discount level we had in tags:

sale-tier-15

sale-tier-25

sale-tier-50

We could create a variable ${Sale_Discount} representing the percentage off, we could extract the number part of these tags. Divide this number by 10. So these values become

0.15

0.25

0.5

Then we could create 2nd variable ${Sale_Price}, this could then use this variable in a formula to intelligently adjust the price depending upon the appearance of this specific tag assigned to the product.

Note: # in the FORMULA function represents the source value (in the case above Variant_Price).

More Formatting Options

As well as this whole new area of function, we have also added some useful new formatting tools.

  • Controlling the case of alphabetic characters in a text string with LOWERCASE, UPPERCASE & PROPERCASE

  • Controlling the number of decimal places for number content with FORMAT NUMBER

By default the feed builder outputs into a created feed number content with the same number of decimal places as the number exists in the source data. Now you have more control.

Note of caution:

The order in which you transform decimal places may have an impact on product of your calculations.

For example say you transform some numeric source data & the formula is to divide it by 3.

Your source data is integer – and one record the value before transformation is 10

The division would result in 3 for this product record – as the number would persist the same decimal places the 3.3 reoccuring would be rounded down to 3.

So say after the division action you re-formatted to one decimal place. This would result in the record having a value of 3.0, not 3.3.

Please give careful thought to the order in which these actions are performed.

  • Controlling the format in which date value data is shown with FORMAT DATE

There is a vast array of ways that you can translate date values in to exactly the format that you need with FORMAT DATE. The full list of date pattern shortcodes that you have at your disposal can be found here in the date-fns help documentation.

Data Source Type Indicators

Finally, another improvement to help you manipulate your store data to get the most value out of it and build the feeds that you need.

Now everywhere where you see a data source, you will see an indicator label to show what type of data this field contains.

Text:

Text Array

Number:

Number Array:

Date:

Boolean:

We are aware that there is a lot to take on board with this update, please if you have any questions or you are wondering if can solve a particular data problem for you – we are more than happy to explore this with you.

Reach out to us via the messenger bubble in the bottom right of the screen or email us at info@feed-donkey.io

Previous Regex – Intro and Use Cases