Search code examples
prestashop

Max shipping cost


How do I set the maximum shipment amount per 199 in PrestaShop 1.7?

It may be smaller, but it may not exceed 199.

In which file do I look for the variable corresponding to the amount of the shipment?


Solution

  • Override function getPackageShippingCost() from Cart class:

    class Cart extends CartCore 
    {
        public function getPackageShippingCost($id_carrier = null, $use_tax = true, Country $default_country = null, $product_list = null, $id_zone = null)
        {
            $shipping_cost = parent::getPackageShippingCost($id_carrier, $use_tax, $default_country, $product_list, $id_zone);
    
            if ($shipping_cost > 199) {
                return 199;
            }
        }
    }
    

    Remember to remove class_index.php and clear cache.