Categories
Digital Marketing Google Ads Shopify Shopping

Add Sale Price to Shopify’s Google Shopping feed

Currently, Shopify’s Google Shopping Integration only sends a single product price to Google Merchant Center. This means that you are unlikely to receive the SALE annotation in your Google Shopping ads when your products are on sale. Here is how to fix that.

As of Aug 12, 2020 Shopify’s Google Shopping app does NOT send compare_at_price to Google Merchant Center. This means that you are unlikely to receive the SALE annotation in your Google Shopping ads when your products are on sale:

Sale annotation in Google Shopping
SALE labels and price markdown annotations usually only appear if you provide Google Shopping with both your regular price (compare_at_price) and your sale price.

To fix this, you must create and upload a supplemental data feed to Google Merchant Center.

Create a Price Feed in Shopify

The first step is to create a data feed in Shopify containing your products sale and regular prices. We can accomplish this by creating a custom Shopify Collection Template that will output XML data instead of HTML:

1. Create a new Collection Template called collection.xml-sale-pricing.liquid with the following code:

{% layout none %}<?xml version="1.0"?>
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0">
{% paginate collection.products by 1000 %}
{%- case shop.currency -%}
{%- when 'USD' -%}{%- assign CountryCode = 'US' -%}
{%- when 'CAD' -%}{%- assign CountryCode = 'CA' -%}
{%- when 'GBP' -%}{%- assign CountryCode = 'GB' -%}
{%- when 'AUD' -%}{%- assign CountryCode = 'AU' -%}
{%- else -%}{%- assign CountryCode = 'US' -%}
{%- endcase -%}
<channel>
<title>{{ shop.name }} {{ collection.title | strip_html | strip_newlines | replace: '&', '&amp;' }}</title>
<link>{{ shop.url }}</link>
<description>{{ collection.description | strip_html | strip_newlines | replace: '&', '&amp;' }}</description>
{% for product in collection.products %} 
  {% for variant in product.variants %}
    {%- if variant.compare_at_price > variant.price -%}
      {%- assign OnSale = true -%}
      {%- assign Price = variant.compare_at_price -%}
      {%- assign SalePrice = variant.price -%}
        <item>
            <g:item_group_id>shopify_{{ CountryCode }}_{{ product.id }}</g:item_group_id>
            <g:id>shopify_{{ CountryCode }}_{{ product.id }}_{{ variant.id }}</g:id>
            <g:price>{{ Price | money_without_currency }} {{ shop.currency }}</g:price>
            <g:sale_price>{{ SalePrice | money_without_currency }} {{ shop.currency }}</g:sale_price>
        </item>
    {%- endif -%}
{% endfor %}
{% endfor %}
</channel>
</rss>
{% endpaginate %}

Also available on github

2. Create a new collection called “google-feed-sale-price” based on your Collection Template

  • IMPORTANT Choose xml-pricing-feed as your collection template
  • Add products to the collection (or you can create an automatic collection with Compare At Price is Greater than 1)

3. Preview the collection and copy the url.

  • Your url should look something like this: yourstoredomain.com/collections/google-feed-sale-price
  • When you preview your page, it should look like a bunch of unformatted text on your page. If you see images, then you probably skipped the first bullet point in Step 2.

Add a Supplemental Data Feed in Google Merchant Center

4. Open Merchant Center and go to
Products > Feeds > Supplemental Feeds > Add Supplemental Feed

  • Name: Sale Pricing Update
  • Feed Type: Scheduled Fetch
  • File Name: google-feed-sale-price
  • File Url: yourstoredomain.com/collections/google-feed-sale-price

Leave everything else as default values and click Continue

5. Make sure there’s a checkmark beside Content API and click Create Feed

6. You should now see your newly created feed in the Supplemental Feeds section. Click on your feed’s name and then click on Fetch Now to update pricing data immediately.

Done

It may take up to 30 minutes for your main feed to be updated. Any new sale pricing will now be uploaded once per day.

Related Reading

27 replies on “Add Sale Price to Shopify’s Google Shopping feed”

Two questions:
1) the template creates an error in the title tag in the html code of the page …/collections/google-feed-sale-price
my site Liquid error: wrong number of arguments (given 1, expected 2..3)

2) it is possible to exclude from indexing search through robots.txt or index nofollow the page …/collections/google-feed-sale-price

Thank you!

Like

Hi, great article and thanks for the help… anyway to show this as .xml in the browser for other affiliates – just now you have to use “view-source:” before the url to see the data ?

Again thanks for the article 🙂

Like

Great Post! Easy to follow. The only issue for me, is that the price in is showing the sale price, but it’s not displayed with the “sales” icon or pop that some of the other listings get. So, the correct price is showing now not the compared at price, it just doesnt say on sale. Any thoughts? Thank you!

Like

Sorry for the late reply.

Your product needs to have been at the “compare at price” for a certain amount of time so that the “SALE” annotation shows up. Also, if the product has been “on sale” for too long, then the SALE annotation might disappear… and then there’s also the case where Google sometimes just decides to do it’s own thing…

Like

Thanks for your response Alex, appreciate it. Do you happen to know the window of time, ie 2 weeks to 6 weeks for the sales pop to appear or is it random? we have approx 100 products on sale, some are rotated every few weeks and others show the compared at price for longer, up to 1 year.

Like

Unfortunately, I’ve never looked into it at this level of detail. All I know for sure is that it’s not consistent. I think you’ll need to do some Google research on this. (But if you do find an answer, please share, as I would love to get the details).

Like

Found the requirement on this page: https://support.google.com/merchants/answer/9017019?hl=en

Requirements
In order for your product to show with sale price annotations, you need to meet certain requirements:

The base price, or the higher price, must have been charged for a period of 30 days (do not need to be consecutive) in the past 200 days.
The base price must be valid.
The sale price must be lower than the base price.
The discount of the sale must be greater than 5% and less than 90%.

Like

If you’d like a content idea for another article. Write about and provide the code to create a local inventory feed.for local ads and local shopping. Myself and others have been searching for a year for a guide on this without having to pay for DataFeedWatch or some third party because we’re too small.

Like

Hi Thank You very much for help with this issue. My google merchant shows that The update could not be matched to an offer. Please make sure to use the identifier of an existing offer and check that the country of sale of the feed is correct. Could You help to solve this error please? Thank You

Like

Hi Joanna — Make sure that the Shopify Google Shopping app/channel is installed and that products are uploaded. Make sure that you only include products in the sale update that are uploaded to the primary google shopping feed.

Like

Hi Alex,

I just set this up and looks like it worked correctly, but will this show a sale tag on the products in google shopping ads? It is only displaying the compare at price, but nothing about a sale.

Like

Hi Marie — Yes, this will cause the SALE price to show up in Google shopping ads. However, the change won’t be instant — it could take a few hours up to a day or so. If by tomorrow the SALE tag is not showing up, then there’s perhaps something wrong with the feed..

Like

Thanks for your tutorial!
But I have a problem, when saving the feed, I get this warning “The file name of the feed is not unique.”
How can I solve? Can I just change the name of the file and the collection?
thank you
Antonio

Like

Hello, great tutorial! Is it normal that the google shopify app directly sends the sale price, which is posted as the actual price, and the full price is not sent to merchant center? Is there a setting to change this?

Like

Currently, yes, this is the normal functionality of the Shopify google shopping app. I assume eventually Shopify will fix this, but the ETA is unknown. There is no setting to change this. The current workaround is to upload a supplemental feed as described in this post.

Like

Hi there thank you very much for this. I have followed all the steps but merchant centre says “Delimiter detection failed” when I try to fetch the feed. Any idea why? Thanks again

Liked by 1 person

Hi Frederics,

The issue is usually that you didn’t select the correct collection template.
Make sure you completed the first bullet point in Step 2.
Make sure when you preview your collection you are only seeing unformatted text, and no images.

Hope this helps.

Alex

Like

Hello Alex,

Thank you for getting back to me so quickly, yes you are right I have tried the steps again and discovered when I select to create a new collection template – there is a single line already there when it being setup {% section ‘collection-template’ %} – I didn’t remove this last time, but I did time and everything is fine now. This is guide is a life saver, thank you!

Liked by 1 person

Hi Alex – I take it this is designed for US & CAD only. If for say UK, I need to amend to something like the following:?

{%- assign CountryCode = ‘US’ -%}
{%- if shop.currency == ‘CAD’ -%}{%- assign CountryCode = ‘CA’ -%}
{%- if shop.currency == ‘GBP’ -%}{%- assign CountryCode = ‘UK’ -%}

Like

Thanks Alex. I have this all working now. Just for others, the correct code for UK is actually:

{%- if shop.currency == ‘GBP’ -%}{%- assign CountryCode = ‘GB’ -%}

I had “CountryCode = ‘UK’” before which turns out to be wrong, it needs to be “GB”

Also might be worth tweaking your article a bit Alex to make it a little clearer. When you create the Collection you need to add the products to it e.g. in my case I made it Automatic and set it to Compare At Price is Greater than 1 (so that the collection only outputs items that are on sale)

Like

Leave a 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