Jump to content

Add Free Shipping for One Carrier Only


Recommended Posts

How can I add free shipping for only one carrier in the list. Prestashop by default assigns free shipping for all the carriers.

 

I am trying to modify the code in the classes--> cart.php.

 

I found the answer here--> http://www.prestashop.com/forums/topic/173177-solved-ps-1482-free-shipping-for-one-carrier-only/ but it is applicable for 1.4.3.

 

$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);
 if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0)
  return $shipping_cost;
 if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0)
  return $shipping_cost;

 

It says to replace the code with the following code.

 

$disable_freeshipping = array(A-ID);
$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);
 if ($orderTotalwithDiscounts >= (float)($free_fees_price) AND (float)($free_fees_price) > 0 AND !in_array($id_carrier, $disable_freeshipping))
  return $shipping_cost;
 if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND !in_array($id_carrier, $disable_freeshipping) AND $this->getTotalWeight() >= (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) AND (float)($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0)
  return $shipping_cost;

 

I am using 1.5.4.1, How can I modify the code to use for my version?

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...