Jump to content

Free shipping for only one carrier (not working)


thezey

Recommended Posts

Hello,

Under Prestashop 1.5.4, I have three carriers and FREE SHIPPING over $99. I need to disable two carriers and just enable one carrier, as I can't ship for free in express. So, I just edited the Cart.php with the following code (note that this only reflects one carrier): 

    // Free fees
        $disable_freeshipping = array('7');
        $free_fees_price = 0;
        if (isset($configuration['PS_SHIPPING_FREE_PRICE']))
            $free_fees_price = Tools::convertPrice((float)$configuration['PS_SHIPPING_FREE_PRICE'], Currency::getCurrencyInstance((int)$this->id_currency));
        $orderTotalwithDiscounts = $this->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING, null, null, false);
        if ($orderTotalwithDiscounts >= (float)($free_fees_price) && (float)($free_fees_price) > 0 && !in_array($id_carrier, $disable_freeshipping))
        {
            Cache::store($cache_id, $shipping_cost);
            return $shipping_cost;
        }

        if (isset($configuration['PS_SHIPPING_FREE_WEIGHT'])
            && $this->getTotalWeight() >= (float)$configuration['PS_SHIPPING_FREE_WEIGHT']
            && (float)$configuration['PS_SHIPPING_FREE_WEIGHT'] > 0
            && !in_array($id_carrier, $disable_freeshipping))
        {
            Cache::store($cache_id, $shipping_cost);
            return $shipping_cost;
        }

However, it is messing everything up and now I got either a blank page or can't add any product to cart. 

 

Could you help me figure out the right code under Prestashop 1.5.4 so that I can disable two carriers for free shipping?

Thank you in advance!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...