Salesforce Shopify Integration: A Step-by-Step Guide
- Badan Singh Pundeer

- Jul 21
- 5 min read
Updated: Sep 23
Introduction
In today’s fast-paced e-commerce landscape, syncing customer, product, and order data between platforms is essential for operational efficiency. One of the most powerful combinations is integrating Shopify, a leading e-commerce platform, with Salesforce, the world’s #1 CRM.
This blog provides a detailed, technical guide to integrating Shopify with Salesforce, enabling real-time data flow and streamlined business processes. Whether you're building a custom solution or using middleware, this guide walks you through the essentials.

Why Integrate Shopify with Salesforce?
Before jumping into the steps, let's understand why Salesforce and Shopify integration matters:
Unified customer view: See order history, preferences, and customer interactions in Salesforce.
Automation: Trigger workflows, send marketing emails, or update inventory automatically.
Improved sales cycle: Sales reps can act on e-commerce insights directly from Salesforce.
Data consistency: Avoid manual errors and duplicated records.
Powerful marketing: Use order history to trigger targeted emails along with loyalty campaigns from Salesforce directly.
Better insights: With Shopify integration, you get accurate reporting and inventory visibility.

Integration Approaches
There are three main approaches to integrating Shopify with Salesforce:
Native Connectors (e.g., Shopify Plus + Salesforce Commerce Cloud)
Middleware Platforms (e.g., MuleSoft, Zapier, Workato)
Custom Integration using APIs
In this blog, we’ll focus on the Custom API Integration, which provides more flexibility and control.

Prerequisites
Before we begin, ensure you have:
A Shopify Admin Account
A Salesforce Developer or Admin Account
Basic knowledge and experience of REST APIs
Access to Salesforce Setup and Shopify Admin setup panels/ Apps
Step 1: Set Up a Private App in Shopify
Log in to your Shopify Admin.
Go to: Apps > App and Sales Channel Settings > Develop apps
Click on Create an app. Provide a name, e.g., Salesforce Sync, and assign an admin contact.
Under Configuration, grant read and write access to:
Customers
Orders
Products
Navigate to API credentials, then click Install app.
Copy your Admin API Access Token and API Key/Secret.
You will use these to authenticate API requests.

Step 2: Create Custom Objects or Use Standard Ones in Salesforce
Salesforce has standard objects like:
Account / Contact – for customer info
Opportunity – for orders
Product2 / PricebookEntry – for product catalog
OR you can also create custom objects such as:
Shopify_Order__c
Shopify_Customer__c
Add fields like:
Order ID
Total Amount
Fulfillment Status
Shopify Customer ID
Tags, Notes, Order Line Items (child records)
Step 3: Create Named Credentials and Auth Provider in Salesforce
To connect Salesforce to Shopify:
Go to Setup > Named Credentials
Click New Named Credential
Label: Shopify_API
Authentication: Named Principal
Identity Type: Anonymous
Set Headers: X-Shopify-Access-Token = <your_token_here>
Alternatively, use Named Credentials with Custom Auth if you want a secure OAuth setup.

Step 4: Build Apex Integration Code
Use HttpRequest and HttpResponse classes in Apex to call Shopify APIs.
Example: Fetch Shopify Orders
Apex Code
public class ShopifyService {
public static void fetchOrders() {
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:Shopify_API/orders.json');
req.setMethod('GET');
Http http = new Http();
HttpResponse res = http.send(req);
if (res.getStatusCode() == 200) {
List<Object> orders = (List<Object>) JSON.deserializeUntyped(res.getBody());
System.debug('Orders: ' + orders);
// Logic to insert/update into Salesforce
} else {
System.debug('Error: ' + res.getStatus());
}
}
}
Step 5: Sync Shopify Data to Salesforce
Map the Shopify fields to Salesforce fields and build data processing logic.
Example Mappings:
Shopify Field | Salesforce Field |
order_number | Order_ID__c |
total_price | Total_Amount__c |
customer.first_name | First_Name__c |
created_at | Order_Date__c |
Use Upsert to prevent duplicates, and always check for data (address, email, currency) integrity.
Step 6: Sync Salesforce Data to Shopify (Optional)
Do you want to create or place orders in Shopify?
You can also create or update customers and orders in Shopify using POST/PUT calls.
Example: Create Customer
apex
public static void createShopifyCustomer(String email, String firstName) {
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:Shopify_API/customers.json');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');
String body = JSON.serialize(new Map<String, Object>{
'customer' => new Map<String, Object>{
'first_name' => firstName,
'email' => email
}
});
req.setBody(body);
Http http = new Http();
HttpResponse res = http.send(req);
System.debug('Create response: ' + res.getBody());
}
Step 7: Schedule, Monitor, and Maintain the Integration
Use Scheduled Apex to run sync jobs hourly/daily.
Set up Platform Events or Change Data Capture (CDC) if near-real-time updates are required.
Use Custom Metadata to control configuration (e.g., last synced timestamp).
Keep track of:
Shopify rate limits (2 req/sec) with retry logic
Salesforce limits and batching
Failed syncs with alerts and retry plans
Read Also: Amazon Connect Integration with Salesforce
Additional Integrations to Consider
Once you have the core Shopify-Salesforce connection working, consider adding the below to make your setup solid, scaalble and truly production ready:
1. Real Time vs Batch Sync
Batc Sync updates every hour or day. It’s easy to set up and is efficient for low-urgency data updates.
Real-time sync, which combines Shopify webhooks with Salesforce, changes happen instantly. It uses Change Data Capture (CDC) or Platform Events, which ensures instant updates that are ideal for live chat prompts.
2. Conflict Resolution & Data Governance
Choose a “system of record”: typically Shopify for order data, Salesforce for customer profiles.
Use simple rules like “last update wins” to decide what to keep when both systems change the same record.
3. Clean Your Data
Before records go into Salesforce:
Format addresses and names properly
Ensures email addresses are valid
Convert currencies (Rs, Dollar, Euro…) consistently
This helps keep your CRM tidy and usable.
4. Monitor and Alert
Watch for errors like failed syncs or rate-limit issues:
Build simple dashboards in Salesforce
Have Slack messages or email alerts for failures, so you get your issues fixed fast
5. Handle Shopify’s API Limits
Shopify generally allows 40 calls in one burst, then refills at 2 calls per second.
To avoid hitting limits:
Check the X-Shopify-Shop-Api-Call-Limit returned header
Wait and retry if you are close to the limit
Send large updates in small batches
Troubleshooting Tips
Issue | Solution |
403 Unauthorized | Check token, endpoint, and permissions |
Missing data | Validate API response and field mappings |
Governor Limits hit | Use batching, limit processing per run |
Shopify rate limits (2 req/sec) | Add retry logic and delay using Limits API |
Conclusion
Integrating Shopify with Salesforce brings loads of value to sales, marketing, and support teams by unifying data and automating processes. While tools like MuleSoft or Zapier can simplify this, a custom API-based integration gives you the most flexibility and control.
At Cloud Science Labs, we help organizations build robust Salesforce integrations tailored to their business needs. We specialize in integrating Salesforce with Shopify, HubSpot, and other platforms. If you are looking to:
Smooth syncing of orders, customers, and products in real time
Create data-driven marketing workflows
Ensure accurate data governance and hassle-free maintenance
Scale your integration with confidence at any volume
CSL is your Salesforce integration partner for Shopify and other E-commerce platforms.
FAQs
1. Can we sync Shopify discounts?
Yes of course. You simply need to pull price_rule_id and map to a Salesforce field, using webhooks.
2. How to handle returns or cancellations?
You can handle this via webhooks, check financial_status or cancelled_at, and update Salesforce accordingly.




Comments