Skip to content

Product Sync Configuration

The Product Sync integration ensures that your WooCommerce product data (prices, stock levels, and sales) stays up-to-date with the remote service. Unlike the Product Import, which is for creating new products, the Sync integration is for maintaining existing ones.

Synchronization Settings

These options determine which data points are overwritten by the remote service during a sync cycle.

OptionDescription
Force syncIf enabled, the plugin will update the product even if no changes are detected. Useful for debugging or recovering from inconsistent data.
Sync stockAutomatically updates the WooCommerce stock quantity based on the remote service's availability.
Sync stock in warehouseSpecifically syncs warehouse-level stock if supported by the remote service.
Sync priceUpdates the product's regular price based on the remote service.
Sync sale priceUpdates the sale price if the product is on promotion in the remote service.
Sync sale datesUpdates the start and end dates for sale prices, ensuring WooCommerce promotions match the remote service.

Preorder & Missing Stock Support

The synchronization process is designed to be resilient. If a remote product exists but simply lacks an active stock record (a common scenario for items in preorder status), the plugin will:

  • Safely set the WooCommerce stock level to 0 to prevent unintended overselling.
  • Continue to sync the regular price and sale price.

This allows you to maintain accurate pricing for pre-sale items even before their inventory records are fully initialized in the remote service.

Product Mapping & Table

At the bottom of the Sync configuration page, you will find the Product List Table. This table maps WooCommerce products to their counterpart in the remote service.

Table Actions

  • Download Remote Product List: Downloads the current product catalog from the remote service. This is required to populate the "Remote Product Id" dropdowns, allowing you to manually map products.
  • Import WC Product List: Scans your WooCommerce store and adds all products to this sync table (populates the table). This establishes the list of products available for mapping, but does not automatically match them to remote IDs.
  • Sync: Triggers an immediate synchronization of price and stock for all products currently in the table.

UI Indicators

  • Red Cell: In the Remote Product Id column, a red background indicates that the remote product is marked as "deleted" or no longer exists in the remote service.
  • Stock Changes:
    • Green Numbers: The current stock level after the last sync.
    • Gray Numbers: The previous stock level (before the change).
    • Arrows: indicates a stock increase; indicates a stock decrease.
  • Sync Status: Displays the last sync timestamp or "not synced yet" if the product hasn't been processed.

Warehouse Stock Data

When Sync stock in warehouse is enabled, the plugin stores a detailed breakdown of stock levels per warehouse in the product meta. This is separate from the total stock quantity managed by WooCommerce.

Developer Access

You can access the warehouse-level data directly from the product meta using the key stock_in_warehouse:

<?php
$warehouse_stock = get_post_meta( $product_id, 'stock_in_warehouse', true );

/**
 * Returns an array of arrays representing the warehouse data.
 * Example structure:
 * [
 *   [
 *     'id'    => '3f07d452-b2b6-11ec-80d3-000c29409daa',
 *     'name'  => '3f07d452-b2b6-11ec-80d3-000c29409daa',
 *     'stock' => 10
 *   ],
 *   ...
 * ]
 */
?>

Provider support varies. Balance and OneSoft expose warehouse-level stock sync; providers that do not return warehouse-level quantities will only sync the total WooCommerce stock quantity.

Running & Scheduling Syncs

Synchronization is a lightweight task compared to importing, as it only updates specific numeric values and does not download images. However, scheduling is still required to keep data fresh.

Admin UI (Small Catalogs)

Inside the integration settings, use the Sync button located in the table footer.

  • When to use: Best for manual updates, testing, or very small catalogs.
  • Action: This triggers an immediate synchronization of all mapped products in the table.
  • Warning: This runs in your browser. Large catalogs may cause the request to time out before every product is updated.

WP-CLI (Large Catalogs & Production)

For reliable and automated performance, use the command line. This is the preferred method for production environments:

# Run from the WordPress installation directory. Replace both placeholders.
cd /path/to/wordpress && /usr/local/bin/wp <service-slug> sync

Note: Replace <service-slug> with the name of your specific plugin (e.g., alta, fina, odoo). /usr/local/bin/wp is common; use which wp to find the correct executable on your server.

For example, a Balance sync on a site installed in /www/goldge_455/public is:

cd /www/goldge_455/public && /usr/local/bin/wp balance sync

HTTP Endpoint Fallback (Small Catalogs)

If WP-CLI is unavailable, you can schedule the public endpoint. Include the timestamp parameter and exclude the endpoint URL from every page cache, CDN, and reverse proxy; a cached Sync done! response does not run WordPress.

0 * * * * wget -O - "https://example.com/wc-api/remote-sync-<service-slug>/products?nocache=$(date +\%s)" >> /dev/null 2>&1

Scheduling Best Practices

  • Frequency: We recommend running the sync command every 10–15 minutes to ensure price and stock accuracy.
  • Conflict Management: If you manually change a price or stock level in WooCommerce, it will be overwritten by the next sync cycle if these options are enabled.