Content settings (XML)
The XML format is widely used for exporting product feeds, especially for marketplaces and advertising platforms that require structured data. With Advanced Product Feeds, you can easily configure and customize an XML feed to fit your needs.
The extension provides pre-made XML templates to simplify the setup process. You can:
-
Copy a template and customize it to match your needs.
-
Modify the structure based on marketplace or advertising platform requirements.
You can customize the feed template by using XML tags to structure product data.
- Static values: hardcoded text inside XML tags. (e.g.,
<gender>women</gender>
) - Dynamic values: attributes from your store (e.g.,
{{ product.name }}
).
Understanding XML schema
Basic XML feed structure
Most shopping engines provide XML feed templates. You can modify these based on their requirements.
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
{% for product in context.products %}
<item>
<id><![CDATA[{{ product.sku }}]]></id>
<title><![CDATA[{{ product.name }}]]></title>
<price><![CDATA[{{ product.price }}]]></price>
</item>
{% endfor %}
</rss>
{% for product in context.products %} ... {% endfor %}
: loops through all products.{{ product.attribute_code }}
: inserts dynamic product data.CDATA
blocks: prevent errors with special characters like<
or&
.
Using loops for data cycles
You can cycle through products, categories, and reviews using loops.
Product data block
Loops through all products in the feed:
{% for product in context.products %}
<item>
<name><![CDATA[{{ product.name }}]]></name>
<price><![CDATA[{{ product.price }}]]></price>
</item>
{% endfor %}
Category data block
Loops through all categories:
{% for category in context.categories %}
<category>
<name><![CDATA[{{ category.name }}]]></name>
</category>
{% endfor %}
Review data block
Loops through all product reviews:
{% for review in context.reviews %}
<review>
<nickname><![CDATA[{{ review.nickname }}]]></nickname>
<rating><![CDATA[{{ review.rating_summary }}]]></rating>
</review>
{% endfor %}
Using attributes and patterns
- Product attributes:
{{ product.attribute_code }}
(e.g.,{{ product.sku }}
,{{ product.price }}
) - Category attributes:
{{ category.name }}
- Review attributes:
{{ review.nickname }}
You can use all attributes from Store -> Attributes -> Product, as well as static attributes like entity_id
and created_at
.
Characters like <
and &
are illegal in XML elements.
<
- will generate an error because the parser interprets it as the start of a new element.
&
- will generate an error because the parser interprets it as the start of a character entity.
We suggest that you enclose all patterns in a CDATA block <attribute><![CDATA[{{ pattern }}]]></attribute>
. In this case, the xml data feed will be valid.