Hi. How can we help?

Custom feeds: creating your own feed

Lightspeed eCom already offers integrations with comparison sites, including Kelkoo, Leguide.com and Google Shopping. They can be easily activated through the Back Office of your online store, allowing your products to be sent to comparison sites immediately. Naturally, there are also sites for which Lightspeed does not yet provide integrations. With the feed builder you can set up a feed yourself. This will enable you to connect your website's data with any site of your choosing.

You can find the feed builder through the left hand menu in the eCom Back Office by clicking Settings. Under Website Settings click Feeds. At the bottom of the screen, click Go to Custom Feeds. Feeds are written in Twig, the flexible, fast, and secure template engine for PHP. Visit the Twig Glossary in this article.

Instagram and Facebook

You can use Custom feeds to sell on Facebook and Instagram. For instructions on how to set this up, visit the Lightspeed Community article titled: How to tag your eCom products in Facebook and Instagram.

Here you will find private and public feeds. Public feeds cannot be modified, since they have to be identical to all Lightspeed eCom customers. Private feeds however, can be changed.

Create a new feed by clicking Add Feed in the navigation at the top of the screen.

The data tags shown offer you the opportunity to forward selected data to external platforms. Copy these codes and put double brackets around them. A tag should look like this:
{{ Tag name }}.

NOTE: Keep in mind that sufficient technical knowledge is an absolute requirement when creating a new feed. Making changes when you do not understand the codes involved may have serious consequences for your online store.

Custom_2.png

Twig Glossary

If you're not sure how to format something, check the Twig documentation or search on Google. The feed editor will automatically check for errors in your code to help you write functions correctly.

HTML tag

Surrounded by: <>

End an HTML tag using '/'. This will appear in the feed exactly as it appears in the code.

Example:

<title> </title>

Google HTML tag

Surrounded by: <g:>

End a google HTML tag with </g:>. This will appear in the feed exactly as it appears in the code. Any attribute you add to a feed must be surrounded by the correct Google HTML tag. Google has a full list here.

Example:

<g:id> </g:id>

Twig Variable

Surrounded by: {{ }} 

Twig variables are used to automatically include product data in your feed. Any variable you add in the code will not appear in the feed. Instead, the value of the variable is displayed. So if you put product.price.price_excl in your code and one of your products costs $1.50, then your feed will show '1.50'. You will usually want to put variables in between Google html tags in your code. A full list of variables appears in the custom feed editor.

Example:

<g:price>{{ product.price.price_excl }} USD</g:price>

Twig filter

Appears after a variable, inside the brackets, after a: | (AKA a 'Pipe').

Twig filters are mainly used in custom feeds to format variables. So if you want your price to always appear in the format 0.00, then you would put the '| money_float' filter after the price variable. For text like titles and descriptions, the 'cdata' filter is used to make sure symbols and punctuation don't break the feed.

Example:

<g:country>{{ shop.country | cdata}}</g:country>

Twig function

Surrounded by: {% %} 

Allows the user to execute code, such as automatically looping through every product. The most common Twig functions are if statements and for loops. These are basic object-oriented programming tools which allow the feed to be created automatically without having to manually include every product. Any function in your code will NOT be shown in the feed. Instead, the code will be run as the feed is created. Loops and if statements must be closed, similar to HTML tags.

Example:

{% if product.image %}
{% endif %}

Twig comment

Surrounded by: {# #}

Allows you to add comments to your code to help explain functions. Comments are never executed and never appear in the feed.

Example:

{% This is a function that will be run %}
{# This is a comment explaining the function in the previous line #}

Was this article helpful?

0 out of 0 found this helpful