PrestaShot Posted August 21, 2014 Share Posted August 21, 2014 Simple task to offer free shipping if a customer buys 2 items. I added in classes/Cart.php this code: $product_array = $this->getProducts(); $pcount = 0; $moreThanOneQuantity = FALSE; foreach($product_array as $product_item) { $pcount++; if($product_item['quantity']>1) $moreThanOneQuantity = TRUE; } if($shipping_cost>0 && ($pcount>1 || $moreThanOneQuantity )) $shipping_cost=0; Where am I wrong? I appreciate any advice. Link to comment Share on other sites More sharing options...
PascalVG Posted August 22, 2014 Share Posted August 22, 2014 For what you want, you don't need to program, just use functionality within prestashop: For this, you can use cart rules: - Add a new cart rule - give a name (like '2 products gives free shipping' or so) - DON'T Fill in a code, to make the cart rule be added automatically on the conditions tab, - set an end date (far) in the future - set the 'amount of uses' of the rule (set high numbers, to make them available for a long time) then: - check the 'product selection' checkbox - add '2' to the minimum amount of products - choose 'categories' and press the Add button - in the pop up, select ALL categories and Add them (they move to the right column) - close the box then in the action tab: - choose 'free shipping' save cart rule see if it works, pascal 1 Link to comment Share on other sites More sharing options...
PrestaShot Posted August 22, 2014 Author Share Posted August 22, 2014 Solved. Thanks Pascal Link to comment Share on other sites More sharing options...
PascalVG Posted August 23, 2014 Share Posted August 23, 2014 Glad it worked :-) Will mark the topic as solved. Hppy selling, pascal Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now