In today’s competitive e-commerce landscape, getting your products in front of the right audience is critical. One of the most effective ways to do that is by syncing your Shopify catalog with Google Shopping—but doing it manually is time-consuming, especially if you’re managing thousands of SKUs.
That’s why many merchants partner with a Shopify Plus agency to automate product feed syncing using Node.js and Google Content APIs.
In this blog, we’ll walk you through a complete guide to automating product sync from Shopify to Google Shopping using Node.js. Whether you're a developer or a Shopify tech partner, this tutorial is for you.
Why Automate Product Feed Syncing?
When your inventory updates frequently, or you're managing multiple markets, manually exporting CSVs or using third-party apps can slow you down.
Automating this process offers:
- Real-time sync of product data (price, availability, title, etc.)
- Reduced ad disapproval due to outdated info
- Better control over Google Merchant Center feeds
- Scalability for growing catalogs
Prerequisites
Before jumping into the code, you’ll need:
- A Shopify Plus store (or any Shopify plan with API access)
- Admin access to Google Merchant Center
- A Google Cloud project with Content API enabled
- Node.js v14+ installed
- An access token for Shopify Admin REST API or GraphQL API
- Service account credentials from Google Cloud Console
Architecture Overview
Here's a quick breakdown of what we’ll build:
- Fetch all products from Shopify using their Admin REST API
- Format the products to match Google Shopping's required schema
- Push the data to Google Merchant Center via Content API
- Automate the sync with a CRON job
Step 1: Setup Your Node.js Project
mkdir shopify-google-feed-sync
cd shopify-google-feed-sync
npm init -y
npm install axios googleapis dotenv
Create a .env
file to store your credentials.
SHOPIFY_API_KEY=your_api_key
SHOPIFY_API_PASSWORD=your_api_password
SHOPIFY_STORE=yourstore.myshopify.com
GOOGLE_MERCHANT_ID=your_merchant_id
GOOGLE_CLIENT_EMAIL=your_service_account_email
GOOGLE_PRIVATE_KEY=your_private_key_in_quotes
Step 2: Fetch Products from Shopify
Use Shopify’s REST Admin API to get product data.
// shopify.js
const axios = require('axios');
require('dotenv').config();
const fetchShopifyProducts = async () => {
const url = `https://${process.env.SHOPIFY_API_KEY}:${process.env.SHOPIFY_API_PASSWORD}@${process.env.SHOPIFY_STORE}/admin/api/2023-04/products.json?limit=100`;
try {
const response = await axios.get(url);
return response.data.products;
} catch (error) {
console.error('Error fetching Shopify products:', error.message);
return [];
}
};
module.exports = { fetchShopifyProducts };
Step 3: Format Products for Google Shopping
// format.js
const formatForGoogle = (shopifyProducts) => {
return shopifyProducts.map(product => ({
offerId: product.id.toString(),
title: product.title,
description: product.body_html.replace(/<[^>]*>/g, ''),
link: `https://${process.env.SHOPIFY_STORE}/products/${product.handle}`,
imageLink: product.image?.src,
contentLanguage: 'en',
targetCountry: 'US',
channel: 'online',
availability: product.variants[0].available ? 'in stock' : 'out of stock',
condition: 'new',
price: {
value: product.variants[0].price,
currency: 'USD'
}
}));
};
module.exports = { formatForGoogle };
Step 4: Push Products to Google Merchant Center
// google.js
const { google } = require('googleapis');
require('dotenv').config();
const getContentAPI = () => {
const auth = new google.auth.JWT(
process.env.GOOGLE_CLIENT_EMAIL,
null,
process.env.GOOGLE_PRIVATE_KEY.replace(/\\n/g, '\n'),
['https://www.googleapis.com/auth/content']
);
return google.content({ version: 'v2.1', auth });
};
const insertProducts = async (products) => {
const content = getContentAPI();
for (const product of products) {
try {
await content.products.insert({
merchantId: process.env.GOOGLE_MERCHANT_ID,
requestBody: product
});
console.log(`Synced product: ${product.title}`);
} catch (error) {
console.error(`Error syncing ${product.title}:`, error.message);
}
}
};
module.exports = { insertProducts };
Step 5: Run Everything Together
// index.js
const { fetchShopifyProducts } = require('./shopify');
const { formatForGoogle } = require('./format');
const { insertProducts } = require('./google');
(async () => {
const shopifyProducts = await fetchShopifyProducts();
const formattedProducts = formatForGoogle(shopifyProducts);
await insertProducts(formattedProducts);
})();
Run the script:
node index.js
Step 6: Set Up CRON for Automation
Use a task scheduler like node-cron
or a system-level cron job:
crontab -e
Example to sync every 6 hours:
0 */6 * * * /usr/bin/node /path/to/your/project/index.js >> /path/to/your/log.txt 2>&1
Bonus: Error Handling & Sync Logs
To make the system production-ready:
- Add logging via Winston or LogDNA
- Track failed syncs and retry
- Validate fields against Google’s product data specification
Why a Shopify Plus Agency Should Automate This
If you're working with a large merchant or managing multiple feeds, automation is not a luxury—it’s a necessity. A Shopify Plus agency can implement advanced sync logic, integrate regional feeds, and even build dashboards to track product approvals.
Conclusion
Syncing Shopify to Google Shopping manually is inefficient. With Node.js and Google’s Content API, you can automate this process in a way that’s fast, scalable, and highly customizable.
This tutorial showed how to:
- Fetch Shopify product data
- Format it for Google Shopping
- Push it to Merchant Center using Node.js
- Schedule it with CRON
If you're building solutions for enterprise merchants or managing multiple catalogs, automation is the future—and Node.js is your toolkit.
Top comments (0)