Describe the bug
Some code public static function addExtraCarriers in classes/Cart.php is not called from anywhere that I can see and appears to be DEAD CODE. This means that the hook 'displayCarrierList' is also defunct, which was previously called 'extraCarrier' hook.
As a triple check, the return values from this function (an array of HOOK_EXTRACARRIER) is not to be found in the code.
To Reproduce
Search the entire codebase for addExtraCarriers and/or displayCarrierList and you'll only find it referenced in the one place.
Additionnal information
PrestaShop version: 1.7.4.2
PHP version: N/A
HI @cmroanirgo,
Thanks for your report.
Yes, As you can see in the deprecated hooks list the extraCarrier / displayCarrierList hook won't be used anymore starting from 1.7.0.0.
If we search Search the entire codebase for addExtraCarriers we will only find it referenced in the one place: https://github.com/PrestaShop/PrestaShop/blob/develop/classes/Cart.php#L4848
@marionf what do you think?
Thanks!
No idea, we will rather ask to a developer: @eternoendless ?
Just a heads up... The reason I went looking at it in the first place was that I used the module generator and added a few hooks in: https://validator.prestashop.com/generator
Edit: @khouloudbelguith Yes, I discovered that it was all deprecated...after the fact. Which begs the question why the code's in there at all?
@PrestaShop/prestashop-core-developers Is there something to do here ?
It looks like it's still used by some modules, but I don't think it's actually useful anymore (see search results)
Wdyt @Quetzacoalt91 ? Should we deprecate the method?
Yeah, we can deprecate it. Displaying additional carriers is now handled by the Carriers instances added in the database. Their cost is then handled by the method getOrderShippingCost, getOrderShippingCostExternal & getPackageShippingCost.
However I would not remove its content for now.
Most helpful comment
Yeah, we can deprecate it. Displaying additional carriers is now handled by the Carriers instances added in the database. Their cost is then handled by the method
getOrderShippingCost,getOrderShippingCostExternal&getPackageShippingCost.However I would not remove its content for now.