WooCommerce wholesale API integration for automotive parts
An automotive parts store lives and dies by how complete and current its catalog is. With tens of thousands of indexes whose availability and price shift at the supplier from one day to the next, maintaining the offer by hand is a losing game. In this project we connected a WooCommerce store directly to a wholesaler’s web service over REST API, so the catalog, stock and prices keep themselves current. The client and supplier names remain confidential.
The problem: selling stock that is not there
The most expensive failure in a store like this is accepting and charging for a part the supplier does not physically hold. It ends in refunds, complaint handling and lost trust. On top of that sits price drift: the wholesaler changes its list, the store keeps selling at the old price, sometimes below its own cost. So the goal was concrete. The catalog must reflect what the supplier actually has available and at what price, with no manual work.
Architecture: WooCommerce wired to the wholesaler web service
The base is WordPress with WooCommerce, and the integration layer is dedicated PHP talking to the wholesaler REST API. The supplier exposes data in both JSON and XML, so the integration parses each and reduces them to one internal model. Synchronisation runs on a schedule in the background (WP-Cron jobs), split into lighter, frequent polling for stock and price and a heavier, less frequent refresh of the full assortment.
Mapping wholesaler data onto WooCommerce products
The wholesaler describes products with its own field structure. The integration’s job is to translate that into the WooCommerce product and attribute model. Among others we map:
- EAN and index - the keys that identify a product and link the store item to its wholesaler record on every subsequent sync.
- Technical attributes - part parameters carried onto WooCommerce attributes and variations so that parameter filters and search work.
- Media and descriptions - images and HTML description codes pulled from the wholesaler endpoints and placed on the product pages.
The field map is declarative, so adding a new parameter from the wholesaler means extending the mapping, not rewriting the logic.
Real-time stock and price synchronisation
The core of the integration is polling the API on a schedule for two things: the stock level of every index and the distributor’s net retail price. Items the supplier does not stock are automatically marked unavailable or hidden, which directly delivers the main goal: a customer cannot buy a part that cannot be fulfilled. A price change in the wholesaler list propagates to the store on the next cycle, with no involvement from staff.
Margin logic
Wholesaler prices are cost, not the selling price. Above the data-pull layer sits margin logic: the system applies a defined shop margin over the distributor’s net retail price automatically, and only the result reaches WooCommerce as the product price. That keeps the store’s target profitability intact even as supplier lists move, and the owner steers margin with rules instead of editing prices by hand.
Outcome
The catalog maintains itself: new wholesaler items appear in the store, discontinued ones drop out, stock and prices track the supplier, and margin protects profitability. Staff stopped updating the offer by hand and stopped fighting orders for parts that were never available. It is the same data-exchange, JSON/XML parsing and stock-mapping mechanism that sits behind WooCommerce integrations with ERP-class systems - it differs in the data source, not the principle.
