BigCommerce Order Sync
Configure and manage order synchronization from BigCommerce stores.
Overview
The BigCommerce Order Sync fetches orders via the BigCommerce v3 API and processes them through the middleware pipeline. It handles BigCommerce-specific features like store credit, custom fields, and staff notes.
Prerequisites
API Credentials
You need a BigCommerce API account with the following scopes:
Required OAuth Scopes:
Orders: Modify (read orders, update status)Products: Read-only (verify product data)Customers: Read-only (customer information)Store Information: Read-only (store details)
Creating API Account
- Log in to BigCommerce store admin
- Go to Settings → API Accounts → Create API Account
- Select V3 API Tokens
- Name:
GSM Middleware - Select scopes (as listed above)
- Click Save
- Copy credentials immediately (shown only once!):
- Client ID
- Access Token
- Store Hash
Configuration
Add BigCommerce Site
- Go to GSM Middleware → Control Panel
- Click "Add Site"
- Fill in the form:
Basic Info:
Site Name: Main BigCommerce Store
Platform: BigCommerce
Site URL: https://mainstore.com
Store Hash: abc123xyz
API Credentials:
Client ID: abc123def456...
Access Token: xyz789ghi012...
Sync Settings:
☑ Enable Order Sync
☑ Enable Inventory Sync
☑ Enable Tracking Sync
- Click "Test Connection"
- If successful, click "Save"
Order Fetching
Fetch Criteria
Default query parameters:
$params = [
'status_id' => 11, // Awaiting Processing
'sort' => 'date_modified:asc',
'limit' => 100,
'min_date_modified' => $last_sync_time,
];
Order Statuses
BigCommerce order status flow:
| Status ID | Status Name | Description |
|---|---|---|
| 11 | Awaiting Processing | New orders (sync from here) |
| 9 | Awaiting Shipment | After successful sync |
| 2 | Awaiting Fulfillment | Alternative processing status |
| 10 | Completed | After shipping |
Customizing Fetch Query
Filter by date range:
// Only sync orders from last 7 days
'min_date_modified' => date('c', strtotime('-7 days')),
Limit results:
'limit' => 50, // Fetch only 50 orders per run
Multiple statuses:
'status_id:in' => '11,2', // Awaiting Processing OR Awaiting Fulfillment
BigCommerce-Specific Features
Store Credit
How it works:
- BigCommerce sends
store_credit_amountat order level - Middleware distributes proportionally across line items
- Separate "STORE CREDIT" line item created with negative amount
Example:
Order subtotal: $100.00
Shipping: $10.00
Tax: $9.00
Store credit: -$11.90 (10% of total)
Line items:
- Product A: $50.00 (credit: -$5.00)
- Product B: $50.00 (credit: -$5.00)
- Shipping: $10.00 (credit: -$1.00)
- Tax: $9.00 (credit: -$0.90)
- STORE CREDIT: -$11.90
Total: $107.10
Custom Fields
Product-level custom fields:
BigCommerce allows custom fields on products. These are captured and stored:
$line_item->custom_fields = [
'Engraving Text' => 'John Doe',
'Gift Wrap' => 'Yes',
];
Stored in rm_lineitems:
INSERT INTO rm_lineitems (
sku,
opt_name1, opt_value1,
opt_name2, opt_value2
) VALUES (
'PRODUCT-SKU',
'Engraving Text', 'John Doe',
'Gift Wrap', 'Yes'
);
Supported fields (up to 10):
opt_name1/opt_value1opt_name2/opt_value2- ... through
opt_name10/opt_value10
Staff Notes
Adding export confirmation:
After successful sync, a staff note is added:
Exported to middleware on 2026-03-17 10:30:45 UTC
Order Number: BGM-12345
Visible to:
- Store administrators only
- Not visible to customers
- Appears in order notes section
Applied Discounts
BigCommerce tracks promotions and discounts:
Coupon codes:
$order->coupon_discount // Total coupon discount
$order->coupons // Array of applied coupons
Automatic promotions:
$line_item->discount_amount // Line-level discount
$line_item->coupon_amount // Coupon applied to line
Middleware handling:
- Coupon codes stored in
rm_lineitems.coupon_code - Discount amounts in
rm_lineitems.discount_amount - Separate "COUPON" line items for order-level coupons
Shipping Methods
BigCommerce provides:
$order->shipping_addresses[0]->shipping_method
Example values:
- "USPS Priority Mail"
- "FedEx 2Day"
- "Free Shipping"
- "Flat Rate"
Mapped to Navision carriers:
$shipping_mapping = [
'USPS Priority Mail' => 'USPS',
'FedEx 2Day' => 'FEDEX',
'FedEx Ground' => 'FEDEX',
'UPS Ground' => 'UPS',
'Free Shipping' => 'USPS', // Default
];
Configure mapping per site:
UPDATE rm_sites
SET shipping_method_mapping = JSON_OBJECT(
'USPS Priority Mail', 'USPS',
'FedEx 2Day', 'FEDEX'
)
WHERE id = 5;
Kit Handling
BigCommerce Kits vs. Product Options
Important distinction:
- BigCommerce "Product Options": Variants (size, color) - NOT kits
- Middleware Kits: Parent SKU that expands to components - defined in
rm_kits
Configuring Kits
If you sell kits/bundles:
- Define in
rm_kitstable:
INSERT INTO rm_kits (site_id, parent_sku, child_sku, quantity)
VALUES
(5, 'KIT-HUNTING-01', 'KNIFE-001', 1),
(5, 'KIT-HUNTING-01', 'FLASHLIGHT-001', 1),
(5, 'KIT-HUNTING-01', 'ROPE-50FT', 1);
- When order contains
KIT-HUNTING-01, it's automatically expanded - Parent SKU remains (line_type: 1), components added (line_type: 2)
Parent SKU Handling
Zero out parent price:
$parent_line->unit_price = 0.00; // Price moved to components
$parent_line->line_type = 1; // Mark as kit parent
Components inherit:
- Customer's ordered quantity × component quantity
- Pro-rated pricing
- Parent line number reference
Payment Gateways
Supported Gateways
BigCommerce supports many payment gateways. Middleware identifies and flags:
| Gateway | Flag Field | Trans ID Source |
|---|---|---|
| Stripe | stripe = 1 | payment_provider_id |
| Klarna | klarna = 1 | payment_provider_id |
| Sezzle | sezzle = 1 | payment_provider_id |
| Credova | credova = 1 | payment_provider_id |
| PayPal | paypal = 1 | payment_provider_id |
| NMI | nmi = 1 | Custom field |
Payment Method Detection
Logic:
if (stripos($order->payment_method, 'stripe') !== false) {
$normalized->stripe = true;
$normalized->trans_id = $order->payment_provider_id;
}
Multiple flags possible:
- Order can have multiple payment methods (split payment)
- All applicable flags set to true
- Trans ID captures primary payment
Transaction ID
Stored in rm_order.trans_id:
- Used for refunds
- Customer service reference
- Payment reconciliation
Updating Order Status
After Successful Sync
Status update to "Awaiting Shipment" (9):
PUT /stores/{store_hash}/v3/orders/{order_id}
{
"status_id": 9
}
Staff note added:
POST /stores/{store_hash}/v3/orders/{order_id}/messages
{
"message": "Exported to middleware on 2026-03-17 10:30:45 UTC\nOrder Number: BGM-12345",
"is_staff_only": true
}
Why Status 9?
- 11 (Awaiting Processing): Initial status, picked up by sync
- 9 (Awaiting Shipment): Signals "exported and ready for fulfillment"
- Prevents re-syncing same order
- Clear workflow for warehouse
Error Handling
Common BigCommerce Errors
401 Unauthorized
Cause: Invalid or expired access token
Solution:
- Regenerate API credentials in BigCommerce
- Update in GSM Middleware site settings
- Test connection
404 Not Found
Cause: Wrong store hash or order doesn't exist
Solution:
- Verify store hash in API Path
- Check order exists in BigCommerce
- Verify order status is 11 (Awaiting Processing)
429 Too Many Requests
Cause: API rate limit exceeded
BigCommerce limits:
- Store API: 20 requests/second
- All requests: 20,000/hour
Solution:
- Reduce sync frequency
- Decrease batch size
- Add delays between requests
422 Unprocessable Entity
Cause: Invalid data in request (e.g., updating status)
Solution:
- Check order status can transition to 9
- Verify order not already in status 9
- Review API request payload
Debug Mode
Enable verbose BigCommerce logging:
// In site settings (custom field)
'debug_api' => true
Logs will include:
- Full API request URLs
- Request headers (credentials redacted)
- Response bodies
- Execution times
Performance Optimization
Batch Processing
Parallel requests (use caution):
// Fetch orders in batches of 100
$page = 1;
do {
$params['page'] = $page;
$params['limit'] = 100;
$orders = $api->getOrders($params);
// Process orders...
$page++;
} while (count($orders) === 100);
Caching
Cache product data:
// Avoid repeated product lookups
$product_cache = [];
if (!isset($product_cache[$product_id])) {
$product_cache[$product_id] = $api->getProduct($product_id);
}
Connection Pooling
Reuse HTTP connections:
// Use persistent connections
$client = new GuzzleHttp\Client([
'base_uri' => 'https://api.bigcommerce.com/',
'timeout' => 30,
'connect_timeout' => 10,
]);
Testing
Test with Single Order
- Create test order in BigCommerce
- Note order ID
- Go to GSM Middleware → Test Order
- Enter order ID
- Click "Test Order Import"
- Review results
Test Store Credit
- Create BigCommerce order
- Apply store credit to order
- Sync order
- Verify
rm_lineitemshas negative "STORE CREDIT" line - Verify proportional distribution
Test Kit Expansion
- Define kit in
rm_kits - Create order with kit parent SKU
- Sync order
- Verify parent + components in
rm_lineitems - Check quantities calculated correctly
Troubleshooting
Orders Not Syncing
Check:
- Order status is 11 (Awaiting Processing)
- Order date >
min_date_modifiedsetting - Order total > $1.00 (if skip test orders enabled)
- API credentials valid
- Site
orders_syncenabled
Store Credit Not Applied
Check:
store_credit_amountpresent in API response- Check
rm_lineitemsfor "STORE CREDIT" line - Verify negative amount
- Check distribution across line items
Kits Not Expanding
Check:
- Kit definition exists in
rm_kits parent_skumatches exactly (case-sensitive)- Component SKUs verified in Business Central
- Site ID matches
Best Practices
- API Credentials: Rotate every 90 days
- Rate Limiting: Monitor API usage in BigCommerce
- Testing: Always test in staging first
- Monitoring: Set up alerts for sync failures
- Documentation: Keep shipping method mapping updated
Next Steps
- WooCommerce Setup - WooCommerce configuration
- Configuration - Sync settings
- BC Export - Export to Business Central