Data Source URL for Pinterest Catalog

Highlighted
Excursionist
25 2 3

@USMenshop 

 

This has nothing to do with the issue at hand - we are discussing catalogs, not rich pins. 

1 Like
Highlighted
Tourist
9 0 1

I am still looking for some help on this.  I have used this code to work on other feeds but for some reason Pinterest is giving me an error. 

Here is what i have done using the code i used for other feeds, with a minor pinterest change (again this is not working, and maybe someone sees the error);

 

1- Make a new Collection called 'Pinterest Feed' - Make sure you add in ALL products that have inventory

2- Make a new Template collection.pinterest.feed.liquid

3- add the following code (Note the Google product Category will need to be built out based on your shops needs)

{% layout none %}<?xml version=“1.0”>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
{%- paginate collection.products by 1000 -%}
<channel>
{%- for product in collection.products -%} 
  {%- if product.variants.size > 0 -%}
  {%- for variant in product.variants -%}
<item>
<g:id>shopify_US_{{ product.id }}_{{ variant.id }}</g:id>
<g:title>{{ product.title | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:title>
<g:description>{{ product.description | replace: '</', ' </' | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:description>
<g:link>{{ shop.url }}{{ variant.url }}</g:link>
<g:item_group_id>{{ product.id }}</g:item_group_id>
  <g:availability>{% if product.available %}In Stock{% else %}Out of Stock{% endif %}</g:availability>
<g:condition>new</g:condition>
  <g:Size_Type>regular</g:Size_Type>
<g:image_link>https:{% if variant.image.src %}{{ variant.image.src | product_img_url: 'grande' }}{% else %}{{ product.featured_image.src | product_img_url: 'grande' }}{% endif %}</g:image_link>
{%- if product.type contains "Kids" -%} <g:agegroup>kids</g:agegroup>
  {% else %} <g:age_group>adult</g:age_group>
  {% endif %}
  <g:gtin>{{ variant.barcode }}</g:gtin>
  {%- if product.type contains "Women" -%}<g:gender>Women</g:gender>
  {%- elsif product.type contains "Men" -%}<g:gender>Men</g:gender>
  {% else %} <g:gender>Unisex</g:gender>
  {% endif %}
<g:mpn>{{ variant.sku }}</g:mpn>
<g:product_type>{{ product.type | replace: '&', '&amp;' }}</g:product_type>
<g:google_product_category></g:google_product_category>

  </item>
  {% endfor %}
  {% else %}

<item>
<g:id>shopify_US_{{ product.id }}_{{ variant.id }}</g:id>
<g:title>{{ product.title | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:title>
<g:description>{{ product.description | replace: '</', ' </' | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:description>
<g:item_group_id>{{ product.id }}</g:item_group_id>
<g:condition>new</g:condition>
  <g:Size_Type>regular</g:Size_Type>
  <g:availability>{% if product.available %}In Stock{% else %}Out of Stock{% endif %}</g:availability>
<g:image_link>https:{{ product.featured_image.src | product_img_url: 'grande' }}</g:image_link>
  {%- if product.type contains "Kids" -%} <g:age_group>kids</g:age_group>
  {% else %} <g:age_group>adult</g:age_group>
  {% endif %}
<g:gtin>{{ product.barcode }}</g:gtin>
   {%- if product.type contains "Women" -%}<g:gender>Women</g:gender>
  {%- elsif product.type contains "Men" -%}<g:gender>Men</g:gender>
  {% else %} <g:gender>Unisex</g:gender>
  {% endif %}
<g:mpn>{{ product.sku }}</g:mpn>
<g:product_type>{{ product.type | replace: '&', '&amp;' }}</g:product_type>
<g:google_product_category> </g:google_product_category>
  </item>
  {% endif %}
{% endfor %}
</channel>
</rss>
{% endpaginate %}

 4- In your collection page change the template to the new Pinterest collection you have created.

 

In theory this should work, as it works with other feeds I currently use. However, i get the same error "Your Feed file has an XML formatting issue. Make sure you are missing a tag"

 

If anybody can see what i am missing that would be super helpful and it will solve everybody's issue here as well.

 

thanks.

0 Likes
Highlighted
Tourist
9 0 1

Ok I solved it. Had one small issue i overlooked. This now 100% works for me. You will need to add in your proper Google Product Categories based on how you store functions.

 

1- Make a new Collection called 'Pinterest Feed' - Make sure you add in ALL products that have inventory

2- Make a new Template collection.pinterest.feed.liquid

3- add the following code (Note the Google product Category will need to be built out based on your shops needs)

 

{% layout none %}<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
{%- paginate collection.products by 1000 -%}
<channel>
  <title>Pinterest Date Feed</title>
  <link>[Your Store NAME]</link>
  <description>Feed for Pinterest catalog</description>
{%- for product in collection.products -%} 
  {%- if product.variants.size > 0 -%}
  {%- for variant in product.variants -%}
<item>
<g:id>shopify_US_{{ product.id }}_{{ variant.id }}</g:id>
<g:title>{{ product.title | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:title>
<g:description>{{ product.description | replace: '</', ' </' | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:description>
 <g:price>{{ variant.price | money_without_currency }} USD</g:price>
  <g:link>{{ shop.url }}{{ variant.url }}</g:link>
<g:item_group_id>{{ product.id }}</g:item_group_id>
  <g:availability>{% if product.available %}In Stock{% else %}Out of Stock{% endif %}</g:availability>
<g:condition>new</g:condition>
  <g:Size_Type>regular</g:Size_Type>
<g:image_link>https:{% if variant.image.src %}{{ variant.image.src | product_img_url: 'grande' }}{% else %}{{ product.featured_image.src | product_img_url: 'grande' }}{% endif %}</g:image_link>
{%- if product.type contains "Kids" -%} <g:agegroup>kids</g:agegroup>
  {% else %} <g:age_group>adult</g:age_group>
  {% endif %}
  <g:gtin>{{ variant.barcode }}</g:gtin>
  {%- if product.type contains "Women" -%}<g:gender>female</g:gender>
  {%- elsif product.type contains "Men" -%}<g:gender>male</g:gender>
  {% else %} <g:gender>unisex</g:gender>
  {% endif %}
<g:mpn>{{ variant.sku }}</g:mpn>
<g:product_type>{{ product.type | replace: '&', '&amp;' }}</g:product_type>

<!--- Add your google product info here (and deleted this note)--->
{%- if product.type == "xxxx" -%}
<g:google_product_category>xxxxxxx</g:google_product_category>
{%- elsif product.type == "xxxxx"-%}<g:google_product_category>xxxxxx</g:google_product_category>
{% endif %}

  </item>
  {% endfor %}
  {% else %}

<item>
<g:id>shopify_US_{{ product.id }}_{{ variant.id }}</g:id>
<g:title>{{ product.title | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:title>
<g:description>{{ product.description | replace: '</', ' </' | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:description>
<g:price>{{ product.price | money_without_currency }} USD</g:price>
  <g:item_group_id>{{ product.id }}</g:item_group_id>
<g:condition>new</g:condition>
  <g:Size_Type>regular</g:Size_Type>
  <g:availability>{% if product.available %}In Stock{% else %}Out of Stock{% endif %}</g:availability>
<g:image_link>https:{{ product.featured_image.src | product_img_url: 'grande' }}</g:image_link>
  {%- if product.type contains "Kids" -%} <g:age_group>kids</g:age_group>
  {% else %} <g:age_group>adult</g:age_group>
  {% endif %}
<g:gtin>{{ product.barcode }}</g:gtin>
   {%- if product.type contains "Women" -%}<g:gender>female</g:gender>
  {%- elsif product.type contains "Men" -%}<g:gender>male</g:gender>
  {% else %} <g:gender>unisex</g:gender>
  {% endif %}
<g:mpn>{{ product.sku }}</g:mpn>
<g:product_type>{{ product.type | replace: '&', '&amp;' }}</g:product_type>

<!--- Add your google product info here (and deleted this note)--->
{%- if product.type == "xxxx" -%}
<g:google_product_category>xxxxxxx</g:google_product_category>
{%- elsif product.type == "xxxxx"-%}<g:google_product_category>xxxxxx</g:google_product_category>
{% endif %}

  </item>
  {% endif %}
{% endfor %}
</channel>
</rss>
{% endpaginate %}

 4- In your collection page change the template to the new Pinterest collection you have created.

5- Go to pinterest and submit your new XML feed and wait 24 hours. 

6- Enjoy.

1 Like
Highlighted
Tourist
7 0 2
I certainly hope this works...I’m not super tech savvy so can you explain a little more what you mean about the google product category needing to be built out?
0 Likes
Highlighted
Tourist
9 0 1

Well it's actually two things that are store specific based on the code i wrote.  The Gender tag and the Google Product Category tag.

 

How I have done it is to use the 'Product Type' and map it to the Google Product Category.  The one problem is, if you have a lot of products this is time consuming to map out. Hopefully you would only need to do it once.  If you add additional Product Types later you would need to update this.  I would not be able to answer how to do this, as it is store specific on how you named all your Product Types.  It is possible to do this via tags as well, if your product types are not that gradular.

 

The gender tag is also store specific, as I mapped this our via 'Product Type' as well. If all your product types are not mapped out with gender specific verbiage, you can always do this via tags.   Unlike the Google Product Category Tag this tag is not mandatory for pinterest (it will give you an alert, not an error). However this is a very important tag if you want to market directly to women/men. With Pinterest being heavily used by women over men, it makes sense to have this tag properly installed so you can save money in marketing costs. 

0 Likes
Highlighted
New Member
1 0 0

 


@adlamoureux wrote:

Well it's actually two things that are store specific based on the code i wrote.  The Gender tag and the Google Product Category tag.

 

How I have done it is to use the 'Product Type' and map it to the Google Product Category.  The one problem is, if you have a lot of products this is time consuming to map out. Hopefully you would only need to do it once.  If you add additional Product Types later you would need to update this.  I would not be able to answer how to do this, as it is store specific on how you named all your Product Types.  It is possible to do this via tags as well, if your product types are not that gradular.

 

The gender tag is also store specific, as I mapped this our via 'Product Type' as well. If all your product types are not mapped out with gender specific verbiage, you can always do this via tags.   Unlike the Google Product Category Tag this tag is not mandatory for pinterest (it will give you an alert, not an error). However this is a very important tag if you want to market directly to women/men. With Pinterest being heavily used by women over men, it makes sense to have this tag properly installed so you can save money in marketing costs. 



Hello. I am not sure if I "Built the Google Out" Can you look at what I wrote? I think I may have done it wrong. I have 6 product types so I am not sure how elseif works when theres more than 2 options. Thank you in advance. 

 

<!-- /templates/collection.liquid -->
{% comment %}
The contents of the collection.liquid template can be found in /sections/collection-template.liquid
{% endcomment %}

{% section 'collection-template' %}

{% layout none %}<?xml version="1.0" encoding="UTF-8"?>

 

<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
{%- paginate collection.products by 1000 -%}
<channel>
<title>Pinterest Data Feed</title>
<link>https://sid-sam.myshopify.com/</link>
<description>Feed for Pinterest catalog</description>

{%- for product in collection.products -%}
{%- if product.variants.size > 0 -%}
{%- for variant in product.variants -%}

<item>
<g:id>shopify_US_{{ product.id }}_{{ variant.id }}</g:id>
<g:title>{{ product.title | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:title>
<g:description>{{ product.description | replace: '</', ' </' | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:description>
<g:price>{{ variant.price | money_without_currency }} USD</g:price>
<g:link>{{ shop.url }}{{ variant.url }}</g:link>
<g:item_group_id>{{ product.id }}</g:item_group_id>
<g:availability>{% if product.available %}In Stock{% else %}Out of Stock{% endif %}</g:availability>
<g:condition>new</g:condition>
<g:Size_Type>regular</g:Size_Type>
<g:image_link>https:{% if variant.image.src %}{{ variant.image.src | product_img_url: 'grande' }}{% else %}{{ product.featured_image.src | product_img_url: 'grande' }}{% endif %}</g:image_link>
{%- if product.type contains "Kids" -%} <g:agegroup>kids</g:agegroup>
{% else %} <g:age_group>adult</g:age_group>
{% endif %}
<g:gtin>{{ variant.barcode }}</g:gtin>
{%- if product.type contains "Women" -%}<g:gender>female</g:gender>
{%- elsif product.type contains "Men" -%}<g:gender>male</g:gender>
{% else %} <g:gender>unisex</g:gender>
{% endif %}
<g:mpn>{{ variant.sku }}</g:mpn>
<g:product_type>{{ product.type | replace: '&', '&amp;' }}</g:product_type>

 

<!--- Add your google product info here (and deleted this note)--->
{%- if product.type == "tops" -%}
<g:google_product_category>194</g:google_product_category>
{%- elsif product.type == "bottoms"-%}<g:google_product_category>204</g:google_product_category>
{% endif %}

 

</item>
{% endfor %}
{% else %}

<item>
<g:id>shopify_US_{{ product.id }}_{{ variant.id }}</g:id>
<g:title>{{ product.title | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:title>
<g:description>{{ product.description | replace: '</', ' </' | strip_html | strip_newlines | replace: '&', '&amp;' }}</g:description>
<g:price>{{ product.price | money_without_currency }} USD</g:price>
<g:item_group_id>{{ product.id }}</g:item_group_id>
<g:condition>new</g:condition>
<g:Size_Type>regular</g:Size_Type>
<g:availability>{% if product.available %}In Stock{% else %}Out of Stock{% endif %}</g:availability>
<g:image_link>https:{{ product.featured_image.src | product_img_url: 'grande' }}</g:image_link>
{%- if product.type contains "Kids" -%} <g:age_group>kids</g:age_group>
{% else %} <g:age_group>adult</g:age_group>
{% endif %}
<g:gtin>{{ product.barcode }}</g:gtin>
{%- if product.type contains "Women" -%}<g:gender>female</g:gender>
{%- elsif product.type contains "Men" -%}<g:gender>male</g:gender>
{% else %} <g:gender>unisex</g:gender>
{% endif %}
<g:mpn>{{ product.sku }}</g:mpn>
<g:product_type>{{ product.type | replace: '&', '&amp;' }}</g:product_type>

 

<!--- Add your google product info here (and deleted this note)--->
{%- if product.type == "accessories" -%}
<g:google_product_category>166</g:google_product_category>
{%- elsif product.type == "shoes"-%}<g:google_product_category>187</g:google_product_category>
{% endif %}

</item>
{% endif %}
{% endfor %}
</channel>
</rss>
{% endpaginate %}

0 Likes
Highlighted
New Member
2 0 0

I am not much into google product category stuff. Can someone explain how can I add that? or is there any document? Where I need to setup google product category?

0 Likes
Highlighted
New Member
2 0 0
What should be final url to submit on data source? i Have tried storename,com/collections/pinterest-feed. but its not working because url should be on xml format. Can anyone help me with this?
0 Likes
Highlighted
Tourist
9 0 1

Yes your url should just be page if you are doing it how I instructed. 

 

example - https://YOURSTORE.com/collections/pinterest-feed

 

if you go to this page yourself.. you should see text only populate.  If you have a lot of products lets say over 500, you maybe having an issue with it fully loading.

0 Likes
Highlighted
Tourist
9 0 1

you need to get the google product category txt document from google and assign categories to products. Simple as that.

 

This cannot be done without that.

0 Likes