Shopify如果要做google shopping广告,就要通过Google Merchant提交product feed信息,试了几个google shopping feed app,感觉
都不是很安全,要求的权限有点过分,相信这个是很多卖家安装Shopify app时不会去关注的点。为了更灵活的生成Google Shopping
feed,结合自己多年程序的经验和参考海外技术分享,总算通过shopify theme的方式去实现了Google Shopping feed.
{%- layout none -%}
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<rss xmlns:g=”http://base.google.com/ns/1.0″ version=”2.0″>
<channel>
<title>{{shop.name | escape }} Products</title>
<link>{{shop.url}}</link>
{% paginate collections.all.products by 1000 %}
{% for product in collections.all.products %}
{% assign productAvailable=’out of stock’ %}
{% assign isAvailable=product.selected_or_first_available_variant.available %}
{% if isAvailable %}
{% assign productAvailable=’in stock’ %}
{% endif %}
<!– Item #{{ forloop.index }} –>
<item>
<title><![CDATA[{{ product.title | strip_html }}]]></title>
<g:brand>{{product.vendor | escape }}</g:brand>
<g:product_type>{{product.type | escape }}</g:product_type>
<g:id>{{product.id}}</g:id>
<g:condition>New</g:condition>
<description><![CDATA[{{ product.description | strip_html }}]]></description>
<g:image_link>{{product.featured_image | product_img_url: ‘large’}}</g:image_link>
<link>{{shop.url}}{{product.url}}</link>
<g:price>{{product.price | money_without_currency | strip_html}} USD</g:price>
<g:quantity>{{product.variants.first.inventory_quantity}}</g:quantity>
<g:identifier_exists>no</g:identifier_exists>
<g:adult>no</g:adult>
<g:availability>{{productAvailable}}</g:availability>
</item>
{% endfor %}
{% endpaginate %}
</channel>
</rss>
如果实施过程有技术问题,欢迎加渔夫QQ:57078101 交流。