Skip to content

Commit 920905d

Browse files
committed
FB Currency feed and other optimizations
1 parent 980ea2b commit 920905d

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{% layout none %}<?xml version="1.0"?>
2+
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
3+
{%- paginate collection.products by 1000 -%}
4+
{%- assign useSEOdescription = true -%}
5+
{%- assign additionalImagesForVariants = false -%}
6+
{%- assign includeOutOfStock = false -%}
7+
{%- assign filterVariantImagesByColor = false -%}
8+
{% comment %}
9+
This template is used to add additional information to the Facebook product catalog
10+
Documentation: https://business.czarto.com/2019/12/11/update-your-shopify-facebook-product-feed-with-missing-attributes/
11+
12+
<comment:title>{{ product.title}} {{variant.title}}</comment:title>
13+
{% endcomment %}
14+
<channel>
15+
<title>{{ shop.name }} {{ collection.title | replace: '&', '&amp;' }}</title>
16+
<link>{{ shop.url }}</link>
17+
<description>{{ collection.description | strip_html }}</description>
18+
{% for product in collection.products %}
19+
{%- if product.variants.size > 0 -%}
20+
{%- for variant in product.variants -%}
21+
22+
{%- assign OnSale = false -%}
23+
{%- assign Price = variant.price -%}
24+
{%- if variant.compare_at_price > variant.price -%}
25+
{%- assign OnSale = true -%}
26+
{%- assign Price = variant.compare_at_price -%}
27+
{%- assign SalePrice = variant.price -%}
28+
{%- endif -%}
29+
30+
<item>
31+
<g:id>{{ variant.id }}</g:id>
32+
<g:content_id>{{ variant.id }}</g:content_id>
33+
<g:price>{{ Price | money_without_currency }} {{ cart.currency.iso_code }}</g:price>
34+
{%- if OnSale -%}
35+
<g:sale_price>{{ SalePrice | money_without_currency }} {{ cart.currency.iso_code }}</g:sale_price>
36+
{%- endif -%}
37+
</item>
38+
39+
{% endfor %}
40+
{%- else -%}
41+
42+
<item>
43+
<g:id>{{ product.id }}</g:id>
44+
<g:price>{{ Price | money_without_currency }} {{ cart.currency.iso_code }}</g:price>
45+
{%- if OnSale -%}
46+
<g:sale_price>{{ SalePrice | money_without_currency }} {{ cart.currency.iso_code }}</g:sale_price>
47+
{%- endif -%}
48+
</item>
49+
50+
{% endif %}
51+
{% endfor %}
52+
</channel>
53+
</rss>
54+
{% endpaginate %}

Templates/collection.fb-product-update.liquid

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Documentation: https://business.czarto.com/2019/12/11/update-your-shopify-facebo
1616
<link>{{ shop.url }}</link>
1717
<description>{{ collection.description | strip_html }}</description>
1818
{% for product in collection.products %}
19+
{%- assign GoogleProductCategory = product.metafields.mm-google-shopping.google_product_category -%}
1920
{%- assign Gender = product.metafields.mm-google-shopping.gender -%}
2021
{%- assign AgeGroup = product.metafields.mm-google-shopping.age_group -%}
2122
{%- assign Material = product.metafields.mm-google-shopping.material -%}
@@ -35,6 +36,8 @@ Documentation: https://business.czarto.com/2019/12/11/update-your-shopify-facebo
3536
<g:id>{{ variant.id }}</g:id>
3637
{% if useSEOdescription and product.metafields.global.description_tag.size > 0 %}<g:description>{{ product.metafields.global.description_tag | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:description>{% endif %}
3738
<g:content_id>{{ variant.id }}</g:content_id>
39+
<link>{{ shop.url }}{{ variant.url }}</link>
40+
<g:google_product_category>{{ GoogleProductCategory | replace: '&', '&amp;' }}</g:google_product_category>
3841
{% if Material %}<g:material>{{ Material }}</g:material>{% endif %}
3942
{% if Gender %}<g:gender>{{ Gender }}</g:gender>{% endif %}
4043
{% if AgeGroup %}<g:age_group>{{ AgeGroup }}</g:age_group>{% endif %}
@@ -50,6 +53,8 @@ Documentation: https://business.czarto.com/2019/12/11/update-your-shopify-facebo
5053

5154
<item>
5255
<g:id>{{ product.id }}</g:id>
56+
<link>{{ shop.url }}{{ product.url }}</link>
57+
<g:google_product_category>{{ GoogleProductCategory | replace: '&', '&amp;' }}</g:google_product_category>
5358
{% if useSEOdescription and product.metafields.global.description_tag.size > 0 %}<description>{{ product.metafields.global.description_tag | strip_html | strip_newlines | replace: '&', '&amp;' }}</description>{% endif %}
5459
{% if Material %}<g:material>{{ Material }}</g:material>{% endif %}
5560
{% if Gender %}<g:gender>{{ Gender }}</g:gender>{% endif %}

0 commit comments

Comments
 (0)