Skip to content

PrestaShop field notes

Fix PrestaShop stock, orders, states, and the Webservice API with a script

A working library of the problems that hit real PrestaShop stores, across stock and inventory, the Webservice API data sync, orders and order states, combinations, categories, and multistore, and how to detect or repair each one with a small Python or Node.js script. Every guide has a diagram of the problem, a diagram of the fix, full code in both languages, tests, and links to the source reports.

Python and Node.js PrestaShop Webservice API Diagrams and full code
Browse all 73 scripts on GitHub Download them all as a zip Field guide PDF (73 fixs, 147 KB) Follow @allanninal Every fix on this page has a tested Python and Node.js script in the repo. Free, and MIT as stated in its README.

Stock & Inventory

10 guides

Stock quantity goes negative after ordering an out of stock product

Ordering a zero stock item drives stock_available quantity negative; script scans for negative quantities and reconciles.

Reconciler

Physical quantity, reserved quantity, and virtual quantity fall out of sync

Physical quantity should equal virtual plus reserved quantity; script recomputes from order details and flags violations.

Diagnostic

Product quantity wrongly doubled or changed when order status changes

Changing an order state can double increment or corrupt stock; script diffs stock movements against expected per state change.

Reconciler

Duplicate key error when updating stock quantity concurrently

Concurrent quantity updates throw a duplicate entry error on the stock table; script finds and merges duplicate stock rows.

Reconciler

Negative stock quantities appear even with backorders disabled

Stock quantity goes negative in single store and multistore setups despite deny backorder settings; script scans all shops and reports or clamps.

Reconciler

Reserved stock quantity drifts from actual pending orders

Reserved quantity stops matching real pending order units and never releases after cancellation; script recomputes from open orders.

Reconciler

Orphaned stock rows remain after a combination is deleted

Deleting a product combination leaves its stock row behind, skewing total quantity; script diffs stock rows against live combinations and deletes orphans.

Reconciler

Combination stock quantities do not sum to the product level total

Backoffice shows a wrong aggregate quantity for products with variants; script sums combination stock and flags mismatches against the product total.

Diagnostic

Order detail stock quantity fields disagree with the real order quantity

A stock reconciliation field can report zero while the ordered quantity is one; script compares the two fields per order line via the API.

Diagnostic

Negative quantities recorded on backorder-paid orders

Orders placed as backorder can leave order lines and stock with negative quantities; script scans for negative quantity rows and normalizes them.

Reconciler

Webservice API Data Sync

11 guides

Product quantity field via webservice always reads or writes as zero

The product resource ignores real stock, always showing quantity zero; script reads and writes the stock endpoint instead and flags stale zero rows.

Reconciler

Stock update via webservice does not sync back to the product quantity field

Updating stock through the API leaves the legacy product quantity field stale or stuck at zero; script cross checks both and reconciles.

Reconciler

PATCH request to the stock endpoint is silently redirected and dropped

PATCH calls get redirected to a GET, so the quantity write never persists; script verifies the update actually applied after every write.

Diagnostic

Updating stock via the API can delete the linked product combination

A stock update call for a variant can wipe out the referenced combination entirely; script detects stock rows whose combination no longer resolves.

Diagnostic

Stock hooks and back in stock alerts never fire on webservice quantity updates

Restocking through the API skips internal hooks so caches and customer back in stock emails never trigger; script compares stock transitions against notification logs.

Diagnostic

Product created via webservice is invisible on the storefront

API created products show active in the backoffice but never appear on the front end due to missing shop or category links; script re-checks and repairs associations.

Repair

Product visibility setting silently reverts after being changed via API

Setting a product visibility flag to hidden can silently reset to visible everywhere; script compares intended versus actual visibility and reapplies it.

Reconciler

Products disappear from the storefront days after being added by API

API created products vanish after a delay from indexing or category link decay; script polls active, visibility, and category links over time.

Diagnostic

Setting a default combination via API throws a duplicate key error

Marking a new variant as default through the API can error out, leaving more than one variant flagged default; script finds combinations with a wrong default count.

Repair

Product images updated via API do not create per shop associations in multistore

Uploading images through the API skips writing the per shop association so images are missing on other shops; script checks each shop images endpoint against the association table.

Diagnostic

Category created via webservice ignores shop scoping in multistore

Posting a category through the API associates it with every shop instead of the intended one; script lists shop associations and flags categories in unintended shops.

Diagnostic

Orders & Order States

7 guides

Order history record is missing for the order's current state

An order shows a current state with no matching history row on record, often after an upgrade; script compares current state to the latest history entry and backfills it.

Reconciler

Order current state field goes stale after order history is edited

Deleting or editing history rows leaves the order's stored current state out of date; script recomputes it from the latest history row and patches it via the API.

Reconciler

Order history entries appear out of chronological order

History rows can be inserted with the wrong timestamp, showing an old status as current; script sorts history by date and flags orders that disagree with the true latest entry.

Diagnostic

Duplicate order history rows created for a single status change

Setting an order status, including through the webservice or with the same state twice, can insert a second identical history row; script finds and dedupes repeated consecutive entries.

Reconciler

Order gets stuck permanently on one status with no history advancing

Status change calls appear to succeed but the order's history never advances past an old state; script polls orders whose state has not changed in an implausible number of days.

Reconciler

Order created via webservice with no current state set at all

Orders created through the API can end up with no state and no history rows; script scans for stateless orders and backfills the correct history entry.

Reconciler

Order reaches a paid state despite the product being out of stock

An order can be marked paid even though its product shows zero stock and backorders are denied; script cross checks order lines against stock at time of order.

Diagnostic

Orders & Payments

4 guides

Orders & Financials

9 guides

Order total does not match the sum of its order line totals

Line totals can drift from the stored order total from rounding or module bugs, especially after editing; script sums order lines and diffs against the stored total.

Diagnostic

Order total wrong after cancelling a line item on an order with a voucher

Removing a product from an order that has a cart rule applied leaves the total incorrect versus a recalculated sum; script detects the delta via the API.

Diagnostic

Split orders show mismatched totals and wrong shipping cost

When one cart splits into multiple orders, one split order can get the wrong carrier and shipping cost; script compares carrier id against shipping charged.

Diagnostic

Refunded quantity exceeds the originally ordered quantity

Repeated partial refunds combined with manual edits can push refunded quantity above ordered quantity, risking a data error; script audits order lines for refunded greater than ordered.

Diagnostic

Partial refund accepted for more than the original line amount

The backoffice and API let a refund amount exceed the original line total with no server side cap; script scans refund records against line totals for overage.

Reconciler

Credit slip amount ignores the original voucher discount

Refunding a discounted order can generate a credit slip that does not subtract the original discount, overstating the refund; script recomputes the expected refund and flags mismatches.

Diagnostic

Refund created via API does not update the order's refunded quantity

Creating a credit slip through the API can leave the order line's refunded quantity stale; script compares the requested refund against the stored refunded quantity.

Diagnostic

Duplicate invoice numbers issued across different orders

Two distinct orders can receive the same invoice number under concurrent checkout load; script queries orders for invoice number collisions.

Diagnostic

Invoice number stays empty after an order is marked shipped via API

An API driven status change can generate the shipment state without populating the order's invoice number; script finds invoiced states with a missing invoice number.

Diagnostic

Vouchers & Cart Rules

6 guides

Customers

2 guides

Catalog & Categories

4 guides

Catalog & Products

5 guides

Multistore

5 guides

Pricing & Tax

3 guides

Shipping & Carriers

4 guides

SEO & Friendly URLs

3 guides

Fighting a PrestaShop bug right now?

If you have a problem in PrestaShop stock, order state, Webservice sync, or multistore that you would rather hand off, this is the kind of work I do. Message me and we can work through it together.

Contact me on LinkedIn

Found this useful?

These guides are free and always will be. If one saved you a support ticket or a refund, you can throw a coffee my way. It keeps the notes coming.

Buy me a coffee on Ko-fi