Skip to content
Back to Articles

PrestaShop Webservice: a safer workflow for product updates

Controlled product updates from external systems
HTTP
GET /api/products/42

CHANGE ONLY KNOWN DATA

PUT /api/products/42

GET + VERIFY
Webservices & API
Intermediate
PrestaHacks 3 min read

Reading product data is the easy part. Writing it back safely is where an integration starts to need rules.

A product update should never mean “send whatever the supplier gave us and hope PrestaShop sorts it out”.

1. Start with a read

Before changing a resource, fetch its current representation and confirm that you found the correct id_product.

TEXT
EXTERNAL SKU
    ↓
filter[reference]
    ↓
id_product
    ↓
GET current product

2. Use the Webservice schema

Build the payload around the structure expected by the product resource. Do not invent fields from spreadsheet column names.

TEXT
SUPPLIER COLUMN
      ↓
INTERNAL MAPPING
      ↓
PRESTASHOP FIELD

3. Separate source data from update rules

Your source may contain:

TEXT
supplier_price
supplier_name
supplier_stock
supplier_category

Your business rules decide whether each value is allowed to change PrestaShop.

For example:

TEXT
supplier_price → update
supplier_name  → keep shop value
supplier_stock → handled by stock workflow
category       → mapped before update

4. Never treat stock as a product field

Stock belongs to the stock resource. Product data and stock updates should be separate, testable steps.

5. Protect identifiers

Do not let a feed silently replace the identifier you use to match records.

If reference is your join key:

TEXT
READ BY reference
UPDATE matched id_product
VERIFY same reference

6. Validate before PUT

Minimum checks:

  • product exists,
  • one unique match,
  • required values are present,
  • numeric values are numeric,
  • mapped IDs exist,
  • language values are intentional,
  • update is inside the allowed field list.

7. Keep an update log

TEXT
timestamp
source identifier
id_product
fields changed
old values
new values
HTTP status
verification status

You do not need an enterprise logging platform. A structured CSV or database table is already much better than no audit trail.

8. Test with one product

Use one product whose current state you know. Update one field, read it again and verify the expected result.

Then test:

  • one simple product,
  • one product with combinations,
  • one multilingual product,
  • one deliberately invalid payload.

9. Batch updates need stop conditions

If the same validation error repeats, do not continue through 5,000 products.

TEXT
ERROR RATE > THRESHOLD
        ↓
STOP
        ↓
REVIEW

10. The production pattern

TEXT
FETCH
  ↓
MATCH
  ↓
VALIDATE
  ↓
TRANSFORM
  ↓
WRITE
  ↓
READ BACK
  ↓
VERIFY
  ↓
LOG

The safest update is not the one with the most automation. It is the one where every transformation is explicit and every write can be verified.

Official references

  • https://devdocs.prestashop-project.org/9/webservice/
  • https://devdocs.prestashop-project.org/9/webservice/resources/products/
  • https://devdocs.prestashop-project.org/9/webservice/tutorials/create-product-az/

Next step

If authentication or resource discovery is not yet repeatable, stabilize the first Webservice request before any write. Then verify that each payload respects the product, combination and stock model, and always re-read the changed resource after the update.

STAY TUNED

Get practical PrestaShop hacks in your inbox.

INACTIVE