Jump to content

Free shipping issue


Recommended Posts

Is there a way to have shipping setup where we offer free shipping UP TO a certain weight?

We'd like to offer free shipping over $100 BUT when shipping weight < 50lbs.

We got hosed on a deal where we sold a product that cost $150 but weighed 120lbs and cost us
$102 to ship.Our profit was $-75.00

Link to comment
Share on other sites

You could try changing line 833 of classes/Cart.php (in PrestaShop v1.3) from:

if ($orderTotalwithDiscounts >= floatval($free_fees_price) AND floatval($free_fees_price) > 0)



to:

if ($orderTotalwithDiscounts >= floatval($free_fees_price) AND floatval($free_fees_price) > 0 AND $this->getTotalWeight() < 50)

Link to comment
Share on other sites

rocky,
seems that the Cart class file is v1.2 even though the admin page says the install is v1.3.0.1.

$configuration = Configuration::getMultiple(array('PS_SHIPPING_FREE_PRICE', 'PS_SHIPPING_HANDLING', 'PS_SHIPPING_METHOD', 'PS_SHIPPING_FREE_MAX_WEIGHT'));
// Free fees
if (isset($configuration['PS_SHIPPING_FREE_PRICE']) AND $orderTotal >= floatval($configuration['PS_SHIPPING_FREE_PRICE']) AND floatval($configuration['PS_SHIPPING_FREE_PRICE']) > 0)
 return $shipping_cost;
/*
if (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) AND $this->getTotalWeight() >= floatval($configuration['PS_SHIPPING_FREE_WEIGHT']) AND floatval($configuration['PS_SHIPPING_FREE_WEIGHT']) > 0)
 return $shipping_cost;
*/
if (isset($configuration['PS_SHIPPING_FREE_MAX_WEIGHT']) AND $orderTotal <= floatval($configuration['PS_SHIPPING_FREE_MAX_WEIGHT'])) 
 return $shipping_cost;



I added the configuration PS_SHIPPING_FREE_MAX_WEIGHT, although I have yet to add it to the admin page, ;-)
I was wondering if the code above would work and whether it should be setup as an if/elseif instead

Also, isn't this kind of redundant in the first if statement?

 AND floatval($configuration['PS_SHIPPING_FREE_PRICE']) > 0)


Because if $configuration['PS_SHIPPING_FREE_PRICE'] is not set, floatval($configuration['PS_SHIPPING_FREE_PRICE']) would return 0

Link to comment
Share on other sites

  • 2 years later...

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