Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Free shipping for X number of the same product.


Recommended Posts

Posted

Hi!

I have a shop that I am currently building and I am having some problems trying to work out how to give the customer free shipping if they order 3 or more of the same product.

 

i.e. 3 x Red yoyos = Free Shipping

 

BUT

 

1 x Yellow Yoyo

1 x Pink Yoyo

1 x Black Yoyo = Charged for shipping.

 

 

Is there something that I can do to allow this.

 

Thanks,

 

Owain.

  • 2 weeks later...
Posted

are these colors in your example product attributes? or separate products? Either case you edit your shipping module function quote. And you retrieve the products from the cart.

 

$products = $cart->get_products();
for( $i=0, $n=sizeof($products); $i<$n; $i++) {
 if($products[$i]['qty'] >= 3) {
// flag free shipping for this item and recalculate cost.
	}
		}

further down when it assigns the $cost variable to the shipping method you could subtract the items that should have free shipping. And make the $cart object global in the quote function.

Posted
are these colors in your example product attributes? or separate products? Either case you edit your shipping module function quote. And you retrieve the products from the cart.

 

$products = $cart->get_products();
for( $i=0, $n=sizeof($products); $i<$n; $i++) {
 if($products[$i]['qty'] >= 3) {
// flag free shipping for this item and recalculate cost.
	}
		}

further down when it assigns the $cost variable to the shipping method you could subtract the items that should have free shipping. And make the $cart object global in the quote function.

 

 

My actual example is bags of dog food.

 

I want to give free shipping to anyone that orders 3 bags of dog food, doesnt matter what make or size.

 

Owain.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...