Handling carrier update

If you have played a bit with the carrier system in the PrestaShop administration panel, you might have noticed that when you update a carrier, the carrier ID changes. In fact, when you update a carrier, PrestaShop will create a new carrier by copying the one you want to update and applying your changes. It will then delete (set the flag deleted to 1) the old carrier.

So if we think about it and if a merchant updates a carrier attached to our module, the carrier ID saved in the configuration table won't match anymore. Do not worry, we can handle this very simply.

First, we will hook our module on the actionCarrierUpdate hook, which, as the name indicates, is called when a carrier is updated. So, add the following code in ...

Get PrestaShop Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.