Facebook Produktkatalog mit Google Shopping PRO SW6 einrichten

Unser Plugin "Google Shopping PRO (facebook, Instagram, Pinterest, Snapchat) für Shopware 6" unterstützt Dich bei der Pflege der Produktdaten Deiner Produkte im Google Shopping als auch bei facebook, Instagram, Pinterest und Snapchat.

In dieser Anleitung findest Du die Templates, die Du verwenden musst um den facebook und Instagram Produktkatalog zu erstellen.

Die Schritt-für-Schritt Anleitung findest Du in der Anleitung für das Plugin "Google Shopping PRO"

und der App "Google Shopping (Shopware 6 cloud)"

Header row / Kopfzeile

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <atom:link href="{{ productExport.salesChannelDomain.url }}/export/{{ productExport.accessKey }}/{{ productExport.fileName }}" rel="self" type="application/rss+xml" />
        <title>{{ context.salesChannel.name }}</title>
        <description>{# change your shop's description #}</description>
        <link>{{ productExport.salesChannelDomain.url }}</link>
        <language>{{ productExport.salesChannelDomain.language.locale.code }}</language>
        <image>
            <url>{# add your logo URL #}</url>
            <title>{{ context.salesChannel.name }}</title>
            <link>{{ productExport.salesChannelDomain.url }}</link>
        </image>

Footer row / Fußzeile

</channel>
</rss>

Product row / Produktzeile (ab SW 6.5.0.0)

{# Entferne diese Zeile, um alle Produkte zu Google Shopping zu übertragen #}
{#% if product.customFields and product.customFields.lenz_google_shopping_active is defined and product.customFields.lenz_google_shopping_active == 1 %#}

{% set sizeByOption = '' %}
{% set colorByOption = '' %}
{% set genderByOption = '' %}

{% for property in product.properties %}
    {% set group = property.group %}
{% endfor %}

{% for group in product.sortedProperties %}
    {% for option in group.options %}
        {% if group.name == "Größe" and option.id in product.optionIds %}
            {% set sizeByOption = option.name %}
        {% endif %}

        {% if group.name == "Farbe" and option.id in product.optionIds %}
            {% set colorByOption = option.name %}
        {% endif %}

        {% if group.name == "Geschlecht" %}
            {% set genderByOption = option.name %}
        {% endif %}
    {% endfor %}
{% endfor %}

{% if product.isCloseout is false or product.availableStock >= product.minPurchase %}
	{% set availability = "in stock" %}
{% elseif (product.availableStock < product.minPurchase) and product.restockTime %}
	{% set availability = "preorder" %}
{% else %}
	{% set availability = "out of stock" %}
{% endif %}

{% set availabilityDate = "" %}
{% if availability == "preorder" or availability == "out_of_stock" %}
	{% set restockTime = 7 %}
	{% if product.restockTime %}
    	{% set restockTime = product.restockTime %}
	{% endif %}
	{% set availabilityDate = ("+" ~ restockTime ~ " days")|date("c") %}
{% endif %}

{% set categoryTaxonomy = "" %}
{% for category in product.categories %}
	{% if lenz_google_shopping_taxonomy is defined and category.translated.customFields.lenz_google_shopping_category_taxonomy is defined and lenz_google_shopping_taxonomy[category.translated.customFields.lenz_google_shopping_category_taxonomy] is defined %}
		{% set categoryTaxonomy = lenz_google_shopping_taxonomy[category.translated.customFields.lenz_google_shopping_category_taxonomy] %}
	{% elseif category.translated.customFields.lenz_google_shopping_category_taxonomy is defined %}
		{% set categoryTaxonomy = category.translated.customFields.lenz_google_shopping_category_taxonomy %}
	{% endif %}
{% endfor %}

{% if product.calculatedPrices.first and product.calculatedPrices.first.listPrice and product.calculatedPrices.first.listPrice.price > product.calculatedPrices.first.unitPrice %}
	{# Rule based pricing - Discounted price #}
	{% set price = product.calculatedPrices.first.listPrice.price %}
	{% set salePrice = product.calculatedPrices.first.unitPrice %}
{% elseif product.calculatedPrices.first is defined and product.calculatedPrices.first.listPrice is defined and product.calculatedPrices.first.listPrice != null %}
	{# Rule based pricing - list price #}
	{% set price = product.calculatedPrices.first.listPrice.price %}
	{% set salePrice = null %}
{% elseif product.calculatedPrices.first is defined and product.calculatedPrices.first.unitPrice is defined %}
	{# Rule based pricing - unit price #}
	{% set price = product.calculatedPrices.first.unitPrice %}
	{% set salePrice = null %}
{% elseif product.calculatedPrice.listPrice and product.calculatedPrice.listPrice.price > product.calculatedPrice.unitPrice %}
	{% set price = product.calculatedPrice.listPrice.price %}
	{% set salePrice = product.calculatedPrice.unitPrice %}
{% else %}
	{# Default price #}
	{% set price = product.calculatedPrice.unitPrice %}
	{% set salePrice = null %}
{% endif %}

{% if product.customFields.lenz_google_shopping_price is defined and product.customFields.lenz_google_shopping_price is not null %}
	{% set price = product.customFields.lenz_google_shopping_price %}
{% endif %}

{% if product.customFields.lenz_google_shopping_sale_price is defined and product.customFields.lenz_google_shopping_sale_price is not null %}
	{% set salePrice = product.customFields.lenz_google_shopping_sale_price %}
{% endif %}

{% set productPrice = price %}
{% if salePrice is not null %}
	{% set productPrice = salePrice %}
{% endif %}

{% set useAlternativeImages = false %}
{% if 
	(
		product.customFields.lenz_google_shopping_image1 is defined
		and product.customFields.lenz_google_shopping_image1 is not empty
	) or (
		product.customFields.lenz_google_shopping_image2 is defined
		and product.customFields.lenz_google_shopping_image2 is not empty
	) or (
		product.customFields.lenz_google_shopping_image3 is defined
		and product.customFields.lenz_google_shopping_image3 is not empty
	) or (
		product.customFields.lenz_google_shopping_image4 is defined
		and product.customFields.lenz_google_shopping_image4 is not empty
	) or (
		product.customFields.lenz_google_shopping_image5 is defined
		and product.customFields.lenz_google_shopping_image5 is not empty
	)  
 %}
	{% set useAlternativeImages = true %}
{% endif %}

{% set imageCounter = 0 %}
<item>
    <g:id>{{ product.productNumber }}</g:id>
    <g:title>{% if product.customFields.lenz_google_shopping_title is defined and product.customFields.lenz_google_shopping_title != "" %}{{ product.customFields.lenz_google_shopping_title|escape }}{% else %}{{ product.translated.name|escape }}{% endif %}</g:title>
    <g:description>{% if product.customFields.lenz_google_shopping_description is defined and product.customFields.lenz_google_shopping_description !="" %}{{ product.customFields.lenz_google_shopping_description|escape }}{% else %}{{ product.translated.description|striptags|slice(0, 5000)|escape }}{% endif %}</g:description>
    <link>{{ seoUrl('frontend.detail.page', {'productId': product.id}) }}</link>
	{% if useAlternativeImages == true %}
		{% set isFirstAlternativeImage = true %}
		{% for i in 1..5 %}
			{% if product.customFields['lenz_google_shopping_image' ~ i] is defined and product.customFields['lenz_google_shopping_image' ~ i] is not empty %}
				{% if isFirstAlternativeImage == true %}
					<g:image_link>LENZGOOGLESHOPPINGIMAGE_{{ product.customFields['lenz_google_shopping_image' ~ i] }}_LENZGOOGLESHOPPINGIMAGE</g:image_link>
					{% set isFirstAlternativeImage = false %}
				{% else %}
					<g:additional_image_link>LENZGOOGLESHOPPINGIMAGE_{{ product.customFields['lenz_google_shopping_image' ~ i] }}_LENZGOOGLESHOPPINGIMAGE</g:additional_image_link>
				{% endif %}
			{% endif %}
		{% endfor %}
	{% else %}
		{% for key, media in product.media|sort((a, b) => a.position <=> b.position) %}
			{% if imageCounter == 0 %}
				<g:image_link>{{ media.media.url }}</g:image_link>
			{% elseif imageCounter < 10 %}
				<g:additional_image_link>{{ media.media.url }}</g:additional_image_link>
			{% endif %}

			{% set imageCounter = imageCounter + 1 %}
		{% endfor %}
	{% endif %}
    <g:availability>{{ availability }}</g:availability>
	{% if product.customFields.lenz_google_shopping_expiration_date is defined and product.customFields.lenz_google_shopping_expiration_date != '' %}<g:expiration_date>{{ product.customFields.lenz_google_shopping_expiration_date }}</g:expiration_date>{% endif %}
    {% if price != null %}
		<g:price>{{ price|number_format(context.currency.itemRounding.decimals, '.', '') }} {{ context.currency.isoCode }}</g:price>
	{% endif %}
	
	{% if salePrice != null %}
		<g:sale_price>{{ salePrice|number_format(context.currency.itemRounding.decimals, '.', '') }} {{ context.currency.isoCode }}</g:sale_price>
	{% endif %}
    {% if product.purchaseunit and product.referenceunit and product.unit %}
        <g:unit_pricing_measure>{{ product.purchaseunit }} {{ product.unit.translated.name|replace({'Stück': 'ct', 'Stck.': 'ct', 'm²': 'sqm', 'Milliliter': 'ml', 'Liter': 'l', 'Kilogramm': 'kg', 'Gramm': 'g', 'Zentimeter': 'cm', 'Meter': 'm'}) }}</g:unit_pricing_measure>
	<g:unit_pricing_base_measure>{{ product.referenceunit }} {{ product.unit.translated.name|replace({'Stück': 'ct', 'Stck.': 'ct', 'm²': 'sqm', 'Milliliter': 'ml', 'Liter': 'l', 'Kilogramm': 'kg', 'Gramm': 'g', 'Zentimeter': 'cm', 'Meter': 'm'}) }}</g:unit_pricing_base_measure>
    {% endif %}
    <g:google_product_category>
		{%- if product.customFields.lenz_google_shopping_google_product_category is defined -%}
			{{- product.customFields.lenz_google_shopping_google_product_category -}}
		{%- elseif product.customFields.lenz_google_shopping_category_number is defined -%}
			{{- product.customFields.lenz_google_shopping_category_number -}}
		{%- elseif categoryTaxonomy is not empty -%}
			{{ categoryTaxonomy }}
		{%- else -%}
			{# Default product category here #}
		{%- endif -%}
	</g:google_product_category>
    <g:product_type>{% if product.categories|length > 0 %}{{ product.categories.first.getBreadCrumb|slice(1)|join(' > ')|raw|escape }}{% endif %}</g:product_type>
    {% if product.translated.customFields.lenz_google_shopping_brand is defined %}<g:brand>{{ product.translated.customFields.lenz_google_shopping_brand|escape }}</g:brand>{% elseif product.manufacturer is defined and product.manufacturer is not null %}<g:brand>{{ product.manufacturer.translated.name|escape }}</g:brand>{% endif %}
    <g:gtin>{{ product.ean|escape }}</g:gtin>
    <g:mpn>{{ product.manufacturerNumber|escape }}</g:mpn>
	<g:identifier_exists>{% if product.ean or (product.manufacturer is defined and product.manufacturer is not null and product.manufacturer.name and product.manufacturerNumber) %}yes{% else %}no{% endif %}</g:identifier_exists>
	<g:condition>{% if product.customFields.lenz_google_shopping_condition is defined and product.customFields.lenz_google_shopping_condition != '' %}{{ product.customFields.lenz_google_shopping_condition|escape }}{% else %}new{% endif %}</g:condition>
    <g:adult>{% if product.customFields.lenz_google_shopping_adult is defined and product.customFields.lenz_google_shopping_adult != '' %}yes{% else %}no{% endif %}</g:adult>
    {% if product.customFields.lenz_google_shopping_multipack is defined and product.customFields.lenz_google_shopping_multipack != '' %}<g:multipack>{{ product.customFields.lenz_google_shopping_multipack|escape }}</g:multipack>{% endif %}
    {% if product.customFields.lenz_google_shopping_is_bundle is defined and product.customFields.lenz_google_shopping_is_bundle != '' %}<g:is_bundle>yes</g:is_bundle>{% endif %}
    {% if product.customFields.lenz_google_shopping_energy_efficiency_class is defined and product.customFields.lenz_google_shopping_energy_efficiency_class != '' %}<g:energy_efficiency_class>{{ product.customFields.lenz_google_shopping_energy_efficiency_class|escape }}</g:energy_efficiency_class>{% endif %}
    {% if product.customFields.lenz_google_shopping_min_energy_efficiency_class is defined and product.customFields.lenz_google_shopping_min_energy_efficiency_class != '' %}<g:min_energy_efficiency_class>{{ product.customFields.lenz_google_shopping_min_energy_efficiency_class|escape }}</g:min_energy_efficiency_class>{% endif %}
    {% if product.customFields.lenz_google_shopping_max_energy_efficiency_class is defined and product.customFields.lenz_google_shopping_max_energy_efficiency_class != '' %}<g:max_energy_efficiency_class>{{ product.customFields.lenz_google_shopping_max_energy_efficiency_class|escape }}</g:max_energy_efficiency_class>{% endif %}
    {% if product.customFields.lenz_google_shopping_age_group is defined and product.customFields.lenz_google_shopping_age_group != '' %}<g:age_group>{{ product.customFields.lenz_google_shopping_age_group|escape }}</g:age_group>{% endif %}
    {% if product.customFields.lenz_google_shopping_color is defined and product.customFields.lenz_google_shopping_color != '' %}<g:color>{{ product.customFields.lenz_google_shopping_color|escape }}</g:color>{% elseif colorByOption != "" %}<g:color>{{ colorByOption|escape}}</g:color>{% endif %}
    {% if product.customFields.lenz_google_shopping_gender is defined and product.customFields.lenz_google_shopping_gender != '' %}<g:gender>{{ product.customFields.lenz_google_shopping_gender|escape }}</g:gender>{% elseif genderByOption != "" %}<g:gender>{{ genderByOption|escape }}</g:gender>{% endif %}
    {% if product.customFields.lenz_google_shopping_material is defined and product.customFields.lenz_google_shopping_material != '' %}<g:material>{{ product.customFields.lenz_google_shopping_material|escape }}</g:material>{% endif %}
    {% if product.customFields.lenz_google_shopping_pattern is defined and product.customFields.lenz_google_shopping_pattern != '' %}<g:pattern>{{ product.customFields.lenz_google_shopping_pattern|escape }}</g:pattern>{% endif %}
    {% if product.customFields.lenz_google_shopping_size is defined and product.customFields.lenz_google_shopping_size != '' %}<g:size>{{ product.customFields.lenz_google_shopping_size|escape }}</g:size>{% elseif sizeByOption != '' %}<g:size>{{ sizeByOption }}</g:size>{% endif %}
    {% if product.customFields.lenz_google_shopping_size_type is defined and product.customFields.lenz_google_shopping_size_type != '' %}<g:size_type>{{ product.customFields.lenz_google_shopping_size_type|escape }}</g:size_type>{% endif %}
    {% if product.customFields.lenz_google_shopping_size_system is defined and product.customFields.lenz_google_shopping_size_system != '' %}<g:size_system>{{ product.customFields.lenz_google_shopping_size_system|escape }}</g:size_system>{% endif %}
    {% if product.customFields.lenz_google_shopping_item_group_id is defined and product.customFields.lenz_google_shopping_item_group_id != '' %}<g:item_group_id>{{ product.customFields.lenz_google_shopping_item_group_id|escape }}</g:item_group_id>{% elseif product.parentId is not null %}<g:item_group_id>{{ product.parentId|escape }}</g:item_group_id>{% endif %}
    {% if product.customFields.lenz_google_shopping_product_highlight is defined and product.customFields.lenz_google_shopping_product_highlight|trim != '' %}
        {% set highlights = product.customFields.lenz_google_shopping_product_highlight|split("\n") %}
        {% for highlight in highlights %}
            <g:product_highlight>{{ highlight|escape }}</g:product_highlight>
        {% endfor %}
    {% endif %}
    <g:custom_label_0>{% if product.customFields.lenz_google_shopping_custom_label0 is defined %}{{ product.customFields.lenz_google_shopping_custom_label0|escape }}{% endif %}</g:custom_label_0>
    <g:custom_label_1>{% if product.customFields.lenz_google_shopping_custom_label1 is defined %}{{ product.customFields.lenz_google_shopping_custom_label1|escape }}{% endif %}</g:custom_label_1>
    <g:custom_label_2>{% if product.customFields.lenz_google_shopping_custom_label2 is defined %}{{ product.customFields.lenz_google_shopping_custom_label2|escape }}{% endif %}</g:custom_label_2>
    <g:custom_label_3>{% if product.customFields.lenz_google_shopping_custom_label3 is defined %}{{ product.customFields.lenz_google_shopping_custom_label3|escape }}{% endif %}</g:custom_label_3>
    <g:custom_label_4>{% if product.customFields.lenz_google_shopping_custom_label4 is defined %}{{ product.customFields.lenz_google_shopping_custom_label4|escape }}{% endif %}</g:custom_label_4>
    {% if product.customFields.lenz_google_shopping_promotion_id is defined and product.customFields.lenz_google_shopping_promotion_id != '' %}<g:promotion_id>{{ product.customFields.lenz_google_shopping_promotion_id|escape }}</g:promotion_id>{% endif %}
	{% if product.customFields.lenz_google_shopping_availability_date is defined and product.customFields.lenz_google_shopping_availability_date != '' %}<g:availability_date>{{ product.customFields.lenz_google_shopping_availability_date|escape }}</g:availability_date>{% elseif availabilityDate != "" %}<g:availability_date>{{ availabilityDate|escape }}</g:availability_date>{% endif %}
    {% if product.customFields.lenz_google_shopping_excluded_destination is defined and product.customFields.lenz_google_shopping_excluded_destination != '' %}<g:excluded_destination>{{ product.customFields.lenz_google_shopping_excluded_destination|escape }}</g:excluded_destination>{% endif %}
    {% if product.customFields.lenz_google_shopping_included_destination is defined and product.customFields.lenz_google_shopping_included_destination != '' %}<g:included_destination>{{ product.customFields.lenz_google_shopping_included_destination|escape }}</g:included_destination>{% endif %}
	{% if product.customFields.lenz_google_shopping_shopping_ads_excluded_country is defined %}<g:shopping_ads_excluded_country>{{ product.customFields.lenz_google_shopping_shopping_ads_excluded_country }}</g:shopping_ads_excluded_country>{% endif %}
    {% if product.customFields.lenz_google_shopping_ships_from_country is defined %}<g:ships_from_country>{{ product.customFields.lenz_google_shopping_ships_from_country }}</g:ships_from_country>{% endif %}
    {% if product.customFields.lenz_google_shopping_cost_of_goods_sold is defined %}<g:cost_of_goods_sold>{{ product.customFields.lenz_google_shopping_cost_of_goods_sold }}</g:cost_of_goods_sold>{% endif %}
    {% if product.customFields.lenz_google_shopping_tax is defined %}<g:tax>{{ product.customFields.lenz_google_shopping_tax }}</g:tax>{% endif %}
    {% if product.customFields.lenz_google_shopping_installment is defined %}<g:installment>{{ product.customFields.lenz_google_shopping_installment }}</g:installment>{% endif %}
    {% if product.customFields.lenz_google_shopping_subscription_cost is defined %}<g:subscription_cost>{{ product.customFields.lenz_google_shopping_subscription_cost }}</g:subscription_cost>{% endif %}
    {% if product.customFields.lenz_google_shopping_loyalty_points is defined %}<g:loyalty_points>{{ product.customFields.lenz_google_shopping_loyalty_points }}</g:loyalty_points>{% endif %}
    {% if product.customFields.lenz_google_shopping_product_details is defined %}<g:product_detail>{{ product.customFields.lenz_google_shopping_product_details }}</g:product_detail>{% endif %}
    {% if product.customFields.lenz_google_shopping_ads_redirect is defined %}<g:ads_redirect>{{ product.customFields.lenz_google_shopping_ads_redirect }}</g:ads_redirect>{% endif %}
    
	<g:shipping>
        <g:country>DE</g:country>
        <g:service>Standard</g:service>
        <g:price>{% if productPrice < 100 %}{{ 4.95 }} {{ context.currency.isoCode }}{% else %}{{ 0.00 }} {{ context.currency.isoCode }}{% endif %}{# change your default delivery costs #}</g:price>
    </g:shipping>	
    {% if product.customFields.lenz_google_shopping_shipping_label is defined and product.customFields.lenz_google_shopping_shipping_label != '' %}<g:shipping_label>{{ product.customFields.lenz_google_shopping_shipping_label|escape }}</g:shipping_label>{% endif %}
    {% if product.weight %}<g:shipping_weight>{{ product.weight|number_format(2, ',', '')|escape }} kg</g:shipping_weight>{% endif %}
    {% if product.length and product.width and product.height %}
		<g:shipping_length>{{ (product.length/10)|number_format(2, ',', '')|escape }} cm</g:shipping_length>
		<g:shipping_width>{{ (product.width/10)|number_format(2, ',', '')|escape }} cm</g:shipping_width>
		<g:shipping_height>{{ (product.height/10)|number_format(2, ',', '')|escape }} cm</g:shipping_height>
	{% endif %}
    {% if product.customFields.lenz_google_shopping_transit_time_label is defined and product.customFields.lenz_google_shopping_transit_time_label != '' %}<g:transit_time_label>{{ product.customFields.lenz_google_shopping_transit_time_label|escape }}</g:transit_time_label>{% endif %}
    {% if product.customFields.lenz_google_shopping_max_handling_time is defined and product.customFields.lenz_google_shopping_max_handling_time != '' %}<g:max_handling_time>{{ product.customFields.lenz_google_shopping_max_handling_time|escape }}</g:max_handling_time>{% endif %}
    {% if product.customFields.lenz_google_shopping_min_handling_time is defined and product.customFields.lenz_google_shopping_min_handling_time != '' %}<g:min_handling_time>{{ product.customFields.lenz_google_shopping_min_handling_time|escape }}</g:min_handling_time>{% endif %}
    {% if product.customFields.lenz_google_shopping_tax_category is defined and product.customFields.lenz_google_shopping_tax_category != '' %}<g:tax_category>{{ product.customFields.lenz_google_shopping_tax_category|escape }}</g:tax_category>{% endif %}
</item>

{# Entferne diese Zeile, um alle Produkte zu Google Shopping zu übertragen #}
{#% endif %#}

Product row / Produktzeile (ab SW 6.4.0.0)

zuletzt aktualisiert am 14.11.22 (slenz)

{# Entferne diese Zeile, um alle Produkte zu Google Shopping zu übertragen #}
{#% if product.customFields and product.customFields.lenz_google_shopping_active is defined and product.customFields.lenz_google_shopping_active == 1 %#}

{% set sizeByOption = '' %}
{% set colorByOption = '' %}
{% set genderByOption = '' %}

{% for group in product.sortedProperties %}
    {% for option in group.options %}
        {% if group.name == "Größe" and option.id in product.optionIds %}
            {% set sizeByOption = option.name %}
        {% endif %}

        {% if group.name == "Farbe" and option.id in product.optionIds %}
            {% set colorByOption = option.name %}
        {% endif %}

        {% if group.name == "Geschlecht" %}
            {% set genderByOption = option.name %}
        {% endif %}
    {% endfor %}
{% endfor %}

{% if product.availableStock >= product.minPurchase %}
	{% set availability = "in stock" %}
{% elseif (product.availableStock < product.minPurchase) and product.restockTime %}
	{% set availability = "preorder" %}
{% else %}
	{% set availability = "out of stock" %}
{% endif %}

{% set availabilityDate = "" %}
{% if availability == "preorder" or availability == "out_of_stock" %}
	{% set restockTime = 7 %}
	{% if product.restockTime %}
    	{% set restockTime = product.restockTime %}
	{% endif %}
	{% set availabilityDate = ("+" ~ restockTime ~ " days")|date("c") %}
{% endif %}

{% if product.calculatedPrices.first and product.calculatedPrices.first.listPrice and product.calculatedPrices.first.listPrice.price > product.calculatedPrices.first.unitPrice %}
	{# Rule based pricing - Discounted price #}
	{% set price = product.calculatedPrices.first.listPrice.price %}
	{% set salePrice = product.calculatedPrices.first.unitPrice %}
{% elseif product.calculatedPrices.first is defined and product.calculatedPrices.first.listPrice is defined and product.calculatedPrices.first.listPrice != null %}
	{# Rule based pricing - list price #}
	{% set price = product.calculatedPrices.first.listPrice.price %}
	{% set salePrice = null %}
{% elseif product.calculatedPrices.first is defined and product.calculatedPrices.first.unitPrice is defined %}
	{# Rule based pricing - unit price #}
	{% set price = product.calculatedPrices.first.unitPrice %}
	{% set salePrice = null %}
{% elseif product.calculatedPrice.listPrice and product.calculatedPrice.listPrice.price > product.calculatedPrice.unitPrice %}
	{% set price = product.calculatedPrice.listPrice.price %}
	{% set salePrice = product.calculatedPrice.unitPrice %}
{% else %}
	{# Default price #}
	{% set price = product.calculatedPrice.unitPrice %}
	{% set salePrice = null %}
{% endif %}

{% set imageCounter = 0 %}
<item>
    <g:id>{{ product.productNumber }}</g:id>
    <g:title>{% if product.customFields.lenz_google_shopping_title is defined and product.customFields.lenz_google_shopping_title != "" %}{{ product.customFields.lenz_google_shopping_title|escape }}{% else %}{{ product.translated.name|escape }}{% endif %}</g:title>
    <g:description>{% if product.customFields.lenz_google_shopping_description is defined and product.customFields.lenz_google_shopping_description !="" %}{{ product.customFields.lenz_google_shopping_description|escape }}{% else %}{{ product.translated.description|striptags|escape }}{% endif %}</g:description>
    <link>{{ seoUrl('frontend.detail.page', {'productId': product.id}) }}</link>
    {% for key, media in product.media|sort((a, b) => a.position <=> b.position) %}
        {% if imageCounter == 0 %}
            <g:image_link>{{ media.media.url }}</g:image_link>
        {% elseif imageCounter < 10 %}
            <g:additional_image_link>{{ media.media.url }}</g:additional_image_link>
        {% endif %}

        {% set imageCounter = imageCounter + 1 %}
    {% endfor %}
    <g:availability>{{ availability }}</g:availability>
	{% if product.customFields.lenz_google_shopping_expiration_date is defined and product.customFields.lenz_google_shopping_expiration_date != '' %}<g:expiration_date>{{ product.customFields.lenz_google_shopping_expiration_date }}</g:expiration_date>{% endif %}
    {% if price != null %}
		<g:price>{{ price|number_format(context.currency.decimalPrecision, '.', '') }} {{ context.currency.isoCode }}</g:price>
	{% endif %}
	
	{% if salePrice != null %}
		<g:sale_price>{{ salePrice|number_format(context.currency.decimalPrecision, '.', '') }} {{ context.currency.isoCode }}</g:sale_price>
	{% endif %}
    {% if product.purchaseunit and product.referenceunit and product.unit %}
        <g:unit_pricing_measure>{{ product.purchaseunit }} {{ product.unit.translated.name|replace({'Stück': 'ct', 'Stck.': 'ct', 'm²': 'sqm', 'Milliliter': 'ml', 'Liter': 'l', 'Kilogramm': 'kg', 'Gramm': 'g', 'Zentimeter': 'cm', 'Meter': 'm'}) }}</g:unit_pricing_measure>
	<g:unit_pricing_base_measure>{{ product.referenceunit }} {{ product.unit.translated.name|replace({'Stück': 'ct', 'Stck.': 'ct', 'm²': 'sqm', 'Milliliter': 'ml', 'Liter': 'l', 'Kilogramm': 'kg', 'Gramm': 'g', 'Zentimeter': 'cm', 'Meter': 'm'}) }}</g:unit_pricing_base_measure>
    {% endif %}
    <g:google_product_category>{% if product.customFields.lenz_google_shopping_google_product_category is defined %}{{ product.customFields.lenz_google_shopping_google_product_category }}{% elseif product.customFields.lenz_google_shopping_category_number is defined %}{{ product.customFields.lenz_google_shopping_category_number }}{% else %}{# Default product category here #}{% endif %}</g:google_product_category>
    <g:product_type>{% if product.categories|length > 0 %}{{ product.categories.first.getBreadCrumb|slice(1)|join(' > ')|raw|escape }}{% endif %}</g:product_type>
    {% if product.customFields.lenz_google_shopping_brand is defined %}<g:brand>{{ product.customFields.lenz_google_shopping_brand|escape }}</g:brand>{% elseif product.manufacturer is defined and product.manufacturer is not null %}<g:brand>{{ product.manufacturer.name|escape }}</g:brand>{% endif %}
    <g:gtin>{{ product.ean|escape }}</g:gtin>
    <g:mpn>{{ product.manufacturerNumber|escape }}</g:mpn>
	<g:identifier_exists>{% if product.ean or (product.manufacturer is defined and product.manufacturer is not null and product.manufacturer.name and product.manufacturerNumber) %}yes{% else %}no{% endif %}</g:identifier_exists>
	<g:condition>{% if product.customFields.lenz_google_shopping_condition is defined and product.customFields.lenz_google_shopping_condition != '' %}{{ product.customFields.lenz_google_shopping_condition|escape }}{% else %}new{% endif %}</g:condition>
    <g:adult>{% if product.customFields.lenz_google_shopping_adult is defined and product.customFields.lenz_google_shopping_adult != '' %}yes{% else %}no{% endif %}</g:adult>
    {% if product.customFields.lenz_google_shopping_multipack is defined and product.customFields.lenz_google_shopping_multipack != '' %}<g:multipack>{{ product.customFields.lenz_google_shopping_multipack|escape }}</g:multipack>{% endif %}
    {% if product.customFields.lenz_google_shopping_is_bundle is defined and product.customFields.lenz_google_shopping_is_bundle != '' %}<g:is_bundle>yes</g:is_bundle>{% endif %}
    {% if product.customFields.lenz_google_shopping_energy_efficiency_class is defined and product.customFields.lenz_google_shopping_energy_efficiency_class != '' %}<g:energy_efficiency_class>{{ product.customFields.lenz_google_shopping_energy_efficiency_class|escape }}</g:energy_efficiency_class>{% endif %}
    {% if product.customFields.lenz_google_shopping_min_energy_efficiency_class is defined and product.customFields.lenz_google_shopping_min_energy_efficiency_class != '' %}<g:min_energy_efficiency_class>{{ product.customFields.lenz_google_shopping_min_energy_efficiency_class|escape }}</g:min_energy_efficiency_class>{% endif %}
    {% if product.customFields.lenz_google_shopping_max_energy_efficiency_class is defined and product.customFields.lenz_google_shopping_max_energy_efficiency_class != '' %}<g:max_energy_efficiency_class>{{ product.customFields.lenz_google_shopping_max_energy_efficiency_class|escape }}</g:max_energy_efficiency_class>{% endif %}
    {% if product.customFields.lenz_google_shopping_age_group is defined and product.customFields.lenz_google_shopping_age_group != '' %}<g:age_group>{{ product.customFields.lenz_google_shopping_age_group|escape }}</g:age_group>{% endif %}
    {% if product.customFields.lenz_google_shopping_color is defined and product.customFields.lenz_google_shopping_color != '' %}<g:color>{{ product.customFields.lenz_google_shopping_color|escape }}</g:color>{% elseif colorByOption != "" %}<g:color>{{ colorByOption|escape}}</g:color>{% endif %}
    {% if product.customFields.lenz_google_shopping_gender is defined and product.customFields.lenz_google_shopping_gender != '' %}<g:gender>{{ product.customFields.lenz_google_shopping_gender|escape }}</g:gender>{% elseif genderByOption != "" %}<g:gender>{{ genderByOption|escape }}</g:gender>{% endif %}
    {% if product.customFields.lenz_google_shopping_material is defined and product.customFields.lenz_google_shopping_material != '' %}<g:material>{{ product.customFields.lenz_google_shopping_material|escape }}</g:material>{% endif %}
    {% if product.customFields.lenz_google_shopping_pattern is defined and product.customFields.lenz_google_shopping_pattern != '' %}<g:pattern>{{ product.customFields.lenz_google_shopping_pattern|escape }}</g:pattern>{% endif %}
    {% if product.customFields.lenz_google_shopping_size is defined and product.customFields.lenz_google_shopping_size != '' %}<g:size>{{ product.customFields.lenz_google_shopping_size|escape }}</g:size>{% elseif sizeByOption != '' %}<g:size>{{ sizeByOption }}</g:size>{% endif %}
    {% if product.customFields.lenz_google_shopping_size_type is defined and product.customFields.lenz_google_shopping_size_type != '' %}<g:size_type>{{ product.customFields.lenz_google_shopping_size_type|escape }}</g:size_type>{% endif %}
    {% if product.customFields.lenz_google_shopping_size_system is defined and product.customFields.lenz_google_shopping_size_system != '' %}<g:size_system>{{ product.customFields.lenz_google_shopping_size_system|escape }}</g:size_system>{% endif %}
    {% if product.customFields.lenz_google_shopping_item_group_id is defined and product.customFields.lenz_google_shopping_item_group_id != '' %}<g:item_group_id>{{ product.customFields.lenz_google_shopping_item_group_id|escape }}</g:item_group_id>{% elseif product.parentId is not null %}<g:item_group_id>{{ product.parentId|escape }}</g:item_group_id>{% endif %}
    {% if product.customFields.lenz_google_shopping_product_highlight is defined and product.customFields.lenz_google_shopping_product_highlight != '' %}<g:product_highlight>{{ product.customFields.lenz_google_shopping_product_highlight|escape }}</g:product_highlight>{% endif %}
    <g:custom_label_0>{% if product.customFields.lenz_google_shopping_custom_label0 is defined %}{{ product.customFields.lenz_google_shopping_custom_label0|escape }}{% endif %}</g:custom_label_0>
    <g:custom_label_1>{% if product.customFields.lenz_google_shopping_custom_label1 is defined %}{{ product.customFields.lenz_google_shopping_custom_label1|escape }}{% endif %}</g:custom_label_1>
    <g:custom_label_2>{% if product.customFields.lenz_google_shopping_custom_label2 is defined %}{{ product.customFields.lenz_google_shopping_custom_label2|escape }}{% endif %}</g:custom_label_2>
    <g:custom_label_3>{% if product.customFields.lenz_google_shopping_custom_label3 is defined %}{{ product.customFields.lenz_google_shopping_custom_label3|escape }}{% endif %}</g:custom_label_3>
    <g:custom_label_4>{% if product.customFields.lenz_google_shopping_custom_label4 is defined %}{{ product.customFields.lenz_google_shopping_custom_label4|escape }}{% endif %}</g:custom_label_4>
    {% if product.customFields.lenz_google_shopping_promotion_id is defined and product.customFields.lenz_google_shopping_promotion_id != '' %}<g:promotion_id>{{ product.customFields.lenz_google_shopping_promotion_id|escape }}</g:promotion_id>{% endif %}
	{% if product.customFields.lenz_google_shopping_availability_date is defined and product.customFields.lenz_google_shopping_availability_date != '' %}<g:availability_date>{{ product.customFields.lenz_google_shopping_availability_date|escape }}</g:availability_date>{% elseif availabilityDate != "" %}<g:availability_date>{{ availabilityDate|escape }}</g:availability_date>{% endif %}
    {% if product.customFields.lenz_google_shopping_excluded_destination is defined and product.customFields.lenz_google_shopping_excluded_destination != '' %}<g:excluded_destination>{{ product.customFields.lenz_google_shopping_excluded_destination|escape }}</g:excluded_destination>{% endif %}
    {% if product.customFields.lenz_google_shopping_included_destination is defined and product.customFields.lenz_google_shopping_included_destination != '' %}<g:included_destination>{{ product.customFields.lenz_google_shopping_included_destination|escape }}</g:included_destination>{% endif %}
	{% if product.customFields.lenz_google_shopping_shopping_ads_excluded_country is defined %}<g:shopping_ads_excluded_country>{{ product.customFields.lenz_google_shopping_shopping_ads_excluded_country }}</g:shopping_ads_excluded_country>{% endif %}
    {% if product.customFields.lenz_google_shopping_ships_from_country is defined %}<g:ships_from_country>{{ product.customFields.lenz_google_shopping_ships_from_country }}</g:ships_from_country>{% endif %}
    {% if product.customFields.lenz_google_shopping_cost_of_goods_sold is defined %}<g:cost_of_goods_sold>{{ product.customFields.lenz_google_shopping_cost_of_goods_sold }}</g:cost_of_goods_sold>{% endif %}
    {% if product.customFields.lenz_google_shopping_tax is defined %}<g:tax>{{ product.customFields.lenz_google_shopping_tax }}</g:tax>{% endif %}
    {% if product.customFields.lenz_google_shopping_installment is defined %}<g:installment>{{ product.customFields.lenz_google_shopping_installment }}</g:installment>{% endif %}
    {% if product.customFields.lenz_google_shopping_subscription_cost is defined %}<g:subscription_cost>{{ product.customFields.lenz_google_shopping_subscription_cost }}</g:subscription_cost>{% endif %}
    {% if product.customFields.lenz_google_shopping_loyalty_points is defined %}<g:loyalty_points>{{ product.customFields.lenz_google_shopping_loyalty_points }}</g:loyalty_points>{% endif %}
    {% if product.customFields.lenz_google_shopping_product_details is defined %}<g:product_detail>{{ product.customFields.lenz_google_shopping_product_details }}</g:product_detail>{% endif %}
    {% if product.customFields.lenz_google_shopping_ads_redirect is defined %}<g:ads_redirect>{{ product.customFields.lenz_google_shopping_ads_redirect }}</g:ads_redirect>{% endif %}
    
	<g:shipping>
        <g:country>DE</g:country>
        <g:service>Standard</g:service>
        <g:price>{% if (salePrice != null and salePrice < 100) or (price < 100) %}{{ 4.95 }} {{ context.currency.isoCode }}{% else %}{{ 0.00 }} {{ context.currency.isoCode }}{% endif %}{# change your default delivery costs #}</g:price>
    </g:shipping>	
    {% if product.customFields.lenz_google_shopping_shipping_label is defined and product.customFields.lenz_google_shopping_shipping_label != '' %}<g:shipping_label>{{ product.customFields.lenz_google_shopping_shipping_label|escape }}</g:shipping_label>{% endif %}
    {% if product.weight %}<g:shipping_weight>{{ product.weight|number_format(context.currency.decimalPrecision, ',', '')|escape }} kg</g:shipping_weight>{% endif %}
    {% if product.customFields.lenz_google_shopping_transit_time_label is defined and product.customFields.lenz_google_shopping_transit_time_label != '' %}<g:transit_time_label>{{ product.customFields.lenz_google_shopping_transit_time_label|escape }}</g:transit_time_label>{% endif %}
    {% if product.customFields.lenz_google_shopping_max_handling_time is defined and product.customFields.lenz_google_shopping_max_handling_time != '' %}<g:max_handling_time>{{ product.customFields.lenz_google_shopping_max_handling_time|escape }}</g:max_handling_time>{% endif %}
    {% if product.customFields.lenz_google_shopping_min_handling_time is defined and product.customFields.lenz_google_shopping_min_handling_time != '' %}<g:min_handling_time>{{ product.customFields.lenz_google_shopping_min_handling_time|escape }}</g:min_handling_time>{% endif %}
    {% if product.customFields.lenz_google_shopping_tax_category is defined and product.customFields.lenz_google_shopping_tax_category != '' %}<g:tax_category>{{ product.customFields.lenz_google_shopping_tax_category|escape }}</g:tax_category>{% endif %}
</item>

{# Entferne diese Zeile, um alle Produkte zu Google Shopping zu übertragen #}
{#% endif %#}

Nachdem der Feed in Shopware erstellt wurde, muss der neue Feed in Facebook in einen Katalog hochgeladen werden.