VirtueMart

WooCommerce

Others

Docs

Support

Demo

Blog

About

Forum
Welcome, Guest
Username: Password: Remember me

TOPIC: Free shipping on certain products

Free shipping on certain products 15 Apr 2015 08:10 #1

Hi
I would like to know how to write the code for this scenario:
My client has several products called upstands and splashbacks and the shipping on these products is chargeable along with all the other products.
But my client would like to offer free delivery on these upstands and splashbacks if they are purchased along with any other product NOT called an upstand or a splashback. Is this possible in the advanced shipping by rules?

Perhaps this could be done a different way with category id numbers rather than product names? The category id's for the upstands is 12 and for the splashbacks it is 11 and there are two other categories that are for all the other products that need to be purchased to get the upstands and splashbacks delivered free these are category 10 and 13

Hope this makes sense.
The administrator has disabled public write access.

Free shipping on certain products 18 Apr 2015 14:40 #2

Dear Chris,
To exclude products of one or more particular categories from the calculation of the quantities (like weight, amount, etc.) on which you base your shipping costs, please see: open-tools.net/forum/shipping-by-rules-p...t-of-a-category.html

Is this what you want?

Best regards,
Reinhold
The administrator has disabled public write access.

Free shipping on certain products 18 Apr 2015 15:28 #3

Hi Reinhold,
Thanks for getting back to me.
What I need is a code for the following:
If a customer purchases any product from category 10 or 13 and then puts a product from category 11 or 12 into the same cart, the delivery charge on the products from category 11 or 12 will be free.
The delivery charge calculated for the products from category 10 or 13 remains the same. If the customer just purchases any product from category 11 or 12 on their own then the delivery charge will be as normal for all products

Thanks
Chris
The administrator has disabled public write access.

Free shipping on certain products 21 Apr 2015 06:45 #4

Hi Reinhold,
I have had a look at the link you send me but I still can't get my head around how to write this code. All the shipping costs are calculated via UK postcode which work brilliantly so I can't put a price in this coding as delivery price depends on postcode area.
Some help on this would be appreciated.

Regards
Chris
The administrator has disabled public write access.

Free shipping on certain products 11 May 2015 23:35 #5

Dear Chris,
This scenario (if a product from category 10 or 13 is bought, then shipping for all products from category 11 and 12 is free) is not really what this plugin is meant for. In particular, this plugin was never designed to calculate shipping costs per article.

There are ways to achieve what you want with that plugin, though they heavily depend on your exact shipping cost structure. To be able to write a rule (or rather modify your existing rules) for you free shipping case, I need to know your whole set of rules.

For example, if you calculate shipping based on the weight of the order, I would write the set of rules like:
Variable=WeightMod; Value=Weight
Variable=WeightMod; Condition=contains_any(Categories, 10, 13); Value=Weight-evaluate_for_categories(Weight, 11, 12)
Name="Shipping is 10€ per kg"; Shipping=10*ceil(WeightMod)
The third rule is where you you would calculate your actual shipping costs. The first two just define a modified weight variable, which excludes categories 11 and 12 if the conditions are met.

Instead of using the Weight variable for the shipping cost, we define a new variable WeightMod, which will be the total weight by default. Only if at least one product from categories 10 or 13 is in the cart (the Condition= in the second rule), then we reduce the weight by the weight of all products from categories 11 and 12.
If no product from cateoris 10 or 13 is in the cart, the WeightMod still contains the full weight, including the weight from categories 11 and 12.

Best regards,
Reinhold
The administrator has disabled public write access.

VM - Shopping cart

 x 

Cart empty

Login Formular