If you use the Shopify Facebook Marketing App to upload your Shopify products to Facebook, you will notice that some product attributes are missing in your feed. As of this writing (Dec 11, 2019) the Shopify App does not import data such as: Product Type, Google Product Category, GTIN, MPN, Age Group, and Gender.

Below are the steps to upload the missing data via a custom collection xml feed.

Step 1: Create an XML Product Feed collection template

Create a custom collection template that will output your products as XML instead of HTML. This will allow you to upload them to Facebook.

  • In the Shopify admin, go to Online Store > Themes > Action > Edit Code
  • Under Templates, choose Add a new Template
  • Choose collection from the drop down and name your template fb-product-update

Paste the code below into your new template and click Save. (Best to copy the code from this link: Shopify Facebook Product Update Template)

{% layout none %}<?xml version="1.0"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
{%- paginate collection.products by 1000 -%}
{% comment %}
This template is used to add additional information to the Facebook product catalog
{% endcomment %}

<channel>
<title>{{ shop.name }} {{ collection.title | replace: '&', '&' }}</title>
<link>{{ shop.url }}</link>
<description>{{ collection.description | strip_html }}</description>
{%- for product in collection.products -%} 
  {%- assign GoogleProductCategory = product.metafields.mm-google-shopping.google_product_category -%}
  {%- assign Gender = product.metafields.mm-google-shopping.gender -%}
  {%- assign AgeGroup = product.metafields.mm-google-shopping.age_group -%}

  {%- if product.variants.size > 0 -%}
  {%- for variant in product.variants -%}
<item>
<g:id>{{ variant.id }}</g:id>
<title>{{ product.title | strip_html | strip_newlines | replace: '&', '&' }}</title>
<description>{{ product.description | replace: '</', ' </' | strip_html | strip_newlines | replace: '&', '&' }}</description>
<link>{{ shop.url }}{{ variant.url }}</link>
<g:google_product_category>{{ GoogleProductCategory | replace: '&', '&'  }}</g:google_product_category>
<g:item_group_id>{{ product.id }}</g:item_group_id>
<g:content_id>{{ variant.id }}</g:content_id>
<g:price>{{ variant.price | money_without_currency }} {{ shop.currency }}</g:price>
<g:condition>new</g:condition>
<g:availability>{% if variant.available %}in stock{% else %}out of stock{% endif %}</g:availability>
<g:image_link>http:{% if variant.image.src %}{{ variant.image.src | product_img_url: 'grande' }}{% else %}{{ product.featured_image.src | product_img_url: 'grande' }}{% endif %}</g:image_link>
<g:gtin>{{ variant.barcode }}</g:gtin>
<g:mpn>{{ variant.sku }}</g:mpn>
<g:product_type>{{ product.type | replace: '&', '&' }}</g:product_type>
<g:age_group>{{ AgeGroup }}</g:age_group>
<g:gender>{{ Gender }}</g:gender>
<g:custom_label_0>{{ product.metafields.mm-google-shopping.custom_label_0 }}</g:custom_label_0>
<g:custom_label_1>{{ product.metafields.mm-google-shopping.custom_label_1 }}</g:custom_label_1>
<g:custom_label_2>{{ product.metafields.mm-google-shopping.custom_label_2 }}</g:custom_label_2>
<g:custom_label_3>{{ product.metafields.mm-google-shopping.custom_label_3 }}</g:custom_label_3>
<g:custom_label_4>{{ product.metafields.mm-google-shopping.custom_label_4 }}</g:custom_label_4>
</item>
  {% endfor %}
  {% else %}

<item>
<title>{{ product.title | strip_html | strip_newlines | replace: '&', '&' }}</title>
<description>{{ product.description | replace: '</', ' </' | strip_html | strip_newlines | replace: '&', '&' }}</description>
<g:id>{{ product.id }}</g:id>
<link>{{ shop.url }}{{ product.url }}</link>
<g:google_product_category>{{ GoogleProductCategory | replace: '&', '&'  }}</g:google_product_category>
<g:item_group_id>{{ product.id }}</g:item_group_id>
<g:price>{{ product.price | money_without_currency }} {{ shop.currency }}</g:price>
<g:condition>new</g:condition>
<g:availability>{% if product.available %}in stock{% else %}out of stock{% endif %}</g:availability>
<g:image_link>http:{{ product.featured_image.src | product_img_url: 'grande' }}</g:image_link>
<g:gtin>{{ product.barcode }}</g:gtin>
<g:mpn>{{ product.sku }}</g:mpn>
<g:product_type>{{ product.type | replace: '&', '&' }}</g:product_type>
<g:age_group>{{ AgeGroup }}</g:age_group>
<g:gender>{{ Gender }}</g:gender>
<g:custom_label_0>{{ product.metafields.mm-google-shopping.custom_label_0 }}</g:custom_label_0>
<g:custom_label_1>{{ product.metafields.mm-google-shopping.custom_label_1 }}</g:custom_label_1>
<g:custom_label_2>{{ product.metafields.mm-google-shopping.custom_label_2 }}</g:custom_label_2>
<g:custom_label_3>{{ product.metafields.mm-google-shopping.custom_label_3 }}</g:custom_label_3>
<g:custom_label_4>{{ product.metafields.mm-google-shopping.custom_label_4 }}</g:custom_label_4>
</item>
  {% endif %}
{% endfor %}
</channel>
</rss>
{% endpaginate %}

2. Assign products to your Feed

Before you can upload your feed, you need to assign products to your feed, and create an actual product collection.

  • In Shopify Admin, go to Products > Collections > Create Collection
  • Enter a Title: “Facebook Product Update”
  • Add Products to the collection (either manually or using conditions).
  • IMPORTANT! Assign your XML TEMPLATE to this collection.
    In the bottom right column of the page, choose collection.fb-product-update as the Theme Template.
  • Save and Preview the collection. You should see unformatted text on the screen. This is your Facebook feed.
  • Copy the url of this page as you need it in the next step.

3. Upload your feed to Facebook

  • Go to your Facebook Business Manager
  • Open Catalog Manager and open the product catalog that Shopify created for you.
  • Click on Product Data Sources in the left hand menu and then click on your product feed
  • Go to Settings or on the Upload Now button
  • Scroll to the bottom of the screen and click on Single Upload and select via URL
  • Paste in the feed url generated in Step 2 and select Update your data feed
  • Click Upload File
  • Wait for Facebook to finish fetching your feed

Done

Your products should now have the missing information added. You will want to repeat this step anytime new products are uploaded to Facebook in order to maintain your data fresh.

It’s just a matter of time before Shopify starts uploading the full data specs to Facebook, but until that time, this is the workaround.

2 Comments

  1. I still use your original manual feed implementation, which seems to work better than the newly implemented Shopify one, partly because we can have ownership of our catalogue rather than the owner being specified as Shopify.

    With that said, I am having an issue with our feed not sending the right content_ids to Facebook. Instead, it sends the the product group ID. This essentially stops the dynamic ads from serving all together. I am trying to modify the above to see if i can make sure the correct content_IDs gets sent through.

    Like

    1. Hi Akin,

      I had similar issues, and never quite figured out how to resolve them. At the time (still?) there wasn’t much documentation available around Shopify’s Facebook pixel implementation with regards to remarketing.

      From Facebook’s side there is “Group Id” and “Content Id”, while on Shopify’s side there’s Variant Id or Product Id. As you mentioned, Shopify seems to pass the Shopify Product Id in the Facebook Group Id variable — I unfortunately haven’t looked deeply at either side’s implementation to be able to help with this, but please let me know if you find a solution (If I figure something out, I will post it here as well).

      Best,
      Alex

      Like

Leave a Reply to Alex Czarto Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s