Jump to content

[SOLVED] Shipping configuration


PrestaShot

Recommended Posts

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

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

post-455771-0-83579500-1408685913_thumb.png

 

 

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

post-455771-0-19020800-1408685942_thumb.png

 

 

- in the pop up, select ALL categories and Add them (they move to the right column)

- close the box

post-455771-0-99818400-1408685963_thumb.png

 

then in the action tab:

- choose 'free shipping'

post-455771-0-73249300-1408685984_thumb.png

 

save cart rule

 

see if it works,

 

 

pascal

 

  • Like 1
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...