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 All code on GitHub

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

Orders & Payments

4 guides

Order created in the wrong state when the amount paid does not match the total

Order validation can create an order in a normal state instead of an error state when paid amount and total disagree; script flags orders where the two totals mismatch.

soon

Order payment row duplicated for certain order state configurations

Validating an order on a state with both paid and validated flags enabled can create two payment rows for one order; script finds orders with duplicate payment amounts.

soon

Total paid real field doubles after a partial payment update

The real amount paid field can be written twice, showing double the actual payment; script sums payment rows and flags mismatches against the stored total.

soon

Orders created via webservice land in a payment error state

API created orders can mismatch total paid against the payment record, forcing a payment error state; script validates totals before and after creation and corrects the payment row.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

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.

soon

Vouchers & Cart Rules

6 guides

Single use voucher redeemed more than its allowed quantity

A voucher limited to one use can be redeemed multiple times under concurrent checkouts; script counts orders against the voucher's quantity limit and flags overuse.

soon

Expired voucher still usable and left attached to orders

A voucher past its expiry date can still be loaded, applied, and paid on an order; script scans carts and orders for voucher associations past their expiry date.

soon

Per customer voucher limit ignored for guest checkouts sharing an email

Guests can reuse the same voucher without limit across repeated guest orders under one email; script counts voucher usage grouped by email to flag overuse.

soon

Free gift line quantity doubles when unrelated cart items are removed

An automatic free product rule can bump the gift line's quantity to two when other items are removed from the cart; script inspects carts for gift lines with quantity above one.

soon

System generated vouchers without a code cannot be deleted and pile up

Automatically generated cart rules with no code accumulate as orphaned unusable records; script lists codeless cart rules with no remaining uses for cleanup.

soon

Free shipping voucher fails to zero out the shipping cost

A voucher marked free shipping can still leave a nonzero shipping line in the cart or order total; script recomputes expected total and flags carts where shipping was not zeroed.

soon

Customers

2 guides

Duplicate customer accounts created from the same email during guest checkout

Guest checkout and account conversion flows can create two customer rows sharing one email; script queries customers by email for a count above one and flags for merge.

soon

Guest order becomes untrackable after registering an account with the same email

A guest order's customer link becomes orphaned once the guest email registers as a full account; script joins orders to customers by email to find and relink orphans.

soon

Catalog & Categories

4 guides

Product left without a valid default category after category deletion

Deleting a category can leave products pointing at a default category id that no longer exists; script finds affected products and reassigns a valid default via the API.

soon

Product default category silently changed or lost after a catalog import

CSV or bulk import can overwrite a product's default category unexpectedly, especially in multistore; script compares default category before and after import batches.

soon

Product's default category is not among its assigned categories

A product's default category id can drift to a category the product is not actually linked to; script cross checks category links against the default category field.

soon

Products or categories orphaned outside the root category tree

Deleting the home category or bad imports can leave categories and products detached from the tree, making them invisible; script walks the category tree via the API to find unreachable nodes.

soon

Catalog & Products

5 guides

Duplicate product reference or SKU allowed across different products

PrestaShop has no built in uniqueness check on the reference field; script queries products grouped by reference and reports collisions across different product ids.

soon

Product duplication leaves a broken partial product after an error

Duplicating a product with combinations can fail partway through yet still create an incomplete duplicate; script finds recently created products with missing combinations or features.

soon

Product has no default combination, causing price to display as zero

A product with variants but no valid default combination id shows a listing price of zero; script scans for missing or invalid default combination ids and repairs them.

soon

Duplicate key error creating a default combination per shop in multistore

Creating or converting a default variant on a second shop can throw a duplicate key error, leaving inconsistent default flags; script checks each product for more than one default combination per shop.

soon

Cover image missing or duplicated, breaking storefront image links

A product can end up with zero or more than one image flagged as cover, breaking the display link or the upload via API; script finds products with a wrong cover image count and flags or fixes them.

soon

Multistore

5 guides

Combination resolved from the wrong shop context in multistore

The product assembler can attach a variant belonging to a different shop, showing wrong price or minimum quantity; script fetches combinations per shop and flags shop mismatches.

soon

Orphaned combinations remain linked after a product is removed from a shop

Removing a product from one shop in multistore leaves its variants still linked to that shop's association table; script cross checks combinations against active shop associations.

soon

Currency exchange rate update in one shop overwrites another shop's rate

Manually updating an exchange rate in one shop context can clobber the rate used by other shops; script snapshots rates per shop and detects unintended overwrites.

soon

Catalog listing shows the wrong price when currency differs per shop

The product listing can pull a different shop's price than the single product page shows; script compares listing price against single product price per shop via the API.

soon

Tax calculation uses the wrong shop's default country rate

Order totals can compute tax using another shop's default country rate instead of the customer's actual country; script recomputes expected tax per order and compares to the stored total.

soon

Pricing & Tax

3 guides

Catalog price rules silently skip products that already have a specific price

A catalog wide discount rule does not apply to products that already carry an individual price override; script finds products excluded from active catalog rules.

soon

Wrong price selected when multiple pricing rules overlap for a customer group

Price rule priority logic can pick a higher price over a better one available for the customer's group or currency; script recalculates the best price and compares it to the API reported price.

soon

Wrong tax rule applied on the product page for the delivery country

A product price can show a tax rate belonging to an unrelated country instead of the delivery address country; script requests price per country and flags tax rule mismatches.

soon

Shipping & Carriers

4 guides

Order stored with no carrier and free shipping the customer was not entitled to

A checkout race can store an order with no carrier assigned and zero shipping despite no free shipping entitlement; script scans orders for a missing carrier alongside zero shipping.

soon

Editing a carrier assigns it a new id and orphans old references

Editing a carrier in the backoffice can create a new carrier id instead of updating in place, orphaning orders that reference the old id; script flags orders whose carrier id resolves to a deleted row.

soon

Order's carrier reference becomes invalid after editing order lines

Editing an order's products or quantities can invalidate its linked carrier id; script validates that every order's carrier id still exists and is not deleted.

soon

Order created via webservice drops the carrier and shipping cost fields

Posting a new order through the API can ignore submitted carrier and shipping fields, causing wrong invoices; script diffs submitted versus stored carrier and shipping values.

soon

SEO & Friendly URLs

3 guides

Duplicate friendly URL slug collides across different products or categories

Two products or categories can share an identical URL slug so only one ever resolves correctly; script queries for duplicate slugs per language and renames the collision.

soon

Friendly URL field accepts invalid values instead of a proper slug

The API or backoffice can save a full URL or invalid characters into the slug field, breaking rewrite rules; script validates slug format across the catalog and fixes bad entries.

soon

Duplicating a product keeps the original's friendly URL unchanged

Product duplication copies the slug verbatim, producing two products sharing one URL; script detects duplicated products sharing a slug and appends a unique suffix.

soon

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