PrestaShop Error Declaration of Cart::getPackageShippingCost
On a PrestaShop site, i get error message
1 2 3 4 5 6 |
(1/1) ContextErrorException Warning: Declaration of Cart::getPackageShippingCost($id_carrier = NULL, $use_tax = true, ?Country $default_country = NULL, $product_list = NULL, $id_zone = NULL) should be compatible with CartCore::getPackageShippingCost($id_carrier = NULL, $use_tax = true, ?Country $default_country = NULL, $product_list = NULL, $id_zone = NULL, bool $keepOrderPrices = false) in Cart.php line 1021 at ErrorHandler->handleError(2, 'Declaration of Cart::getPackageShippingCost($id_carrier = NULL, $use_tax = true, ?Country $default_country = NULL, $product_list = NULL, $id_zone = NULL) should be compatible with CartCore::getPackageShippingCost($id_carrier = NULL, $use_tax = true, ?Country $default_country = NULL, $product_list = NULL, $id_zone = NULL, bool $keepOrderPrices = false)', '/var/www/vhosts/site.com/httpdocs/override/classes/Cart.php', 1021, array('className' => 'Cart', 'classDir' => '/var/www/vhosts/site.com/httpdocs/')) in PrestaShopAutoload.php line 152 |
To fix this error, edit the file (location of the file depends on your hosting provider, on cpanel servers, it is public_html folder, on Plesk servers, it is httpdocs).
1 |
override/classes/Cart.php |
Find line
1 |
public function getPackageShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null, $id_zone = null) |
Replace with
1 |
public function getPackageShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null, $id_zone = null, $keepOrderPrices = false) |
This is because orderide class have improper function definiation, this may be due to some outdated PrestaShop modules.
See PrestaShop