With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.
It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!
Welcome,
Guest
|
|
We have a unique packet that we want to ship out and we want to set it up so that it is either free shipping if it is the only product in our cart or it is excluded from shipping costs if other items are in the cart with it.
So I want to set it up so that if they buy "packet-sku" as an individual item or add it to the cart with other things, this product is either free shipping (solo) or not included in the cost of shipping (combined with others). Is there a clean way to do this? |
|
Dear Sean_nwfss,
There is no trivial way to exclude one product from the shipping cost calculation, but it is still not very complicated: First, you handle the case that only that particular product is bought. For the rest you need to exclude this one product from all values that influence your shipping costs. E.g. if you base your shipping costs on the weight, you need to define a custom variable that holds the weight of all products except for the packet-sku product (or rather, you simply subtract the weight of all (possibly zero) packet-sku Products in the cart from the total weight). You need to do this for every varible that influences your shipping costs. Condition=contains_only(SKUs, "packet-sku"); Shipping=0
Variable=MyWeight; Value=Weight - evaluate_for_skus(Weight, "packet-sku")
Name="relevant weight below 10kg"; MyWeight<10; Shipping=5
Name="relevant weight 10kg or above"; MyWeight>=10; Shipping=15 The MyWeight variable holds the weight of all products in the cart except for the "packet-sku" product (if it is in the cart at all). So after you define that variable, you would base all your weight checks in the MyWeight variable rather than the Weight variable. Best regards, Reinhold |
|
We don't do any weights, we simply base our shipping on totals. Here is what our calculation looks like:
Name=Under $25; 0<=AmountAfterCoupon<25; Shipping=4.50 Name=Under $50; 25<=AmountAfterCoupont<50; Shipping=7.50 Name=Under $100; 50<=AmountAfterCoupon<100; Shipping=9.50 Name=Under $150; 100<=AmountAfterCoupon<150; Shipping=18 Name=Under $200; 150<=AmountAfterCoupon<200; Shipping=24 etc. If we don't use any variables how would I exclude the packet-sku from the calculations? |
|
Dear Sean_nwfss,
Thanks for your rules. The problem is that AmountAfterCoupon is a value that can only be calculated at cart-level, not for parts of the cart (as it is provided by VirtueMart and not actually calculated by our plugin). In particular, coupons can be an absolute or a relative Discount. Now, VM will first calculate the actual discount amount for relative discounts, which the plugin will then access. So for the shipping plugin there is no way to distinguish relative and absolute discounts. There are Workarounds, depending on whether your discounts are always absolute or always relative Discounts. If you use absolute discounts, simply calculate the amount for the packet-sku products and subtract it from AmountAfterCoupon. Condition=contains_only(SKUs, "packet-sku"); Shipping=0
Variable=MyAmount; Value=AmountAfterCoupon - evaluate_for_skus(Amount, "packet-sku")
Name=Under $25; 0<=MyAmount<25; Shipping=4.50
... Do you want your $25 threshold for the 4.50 shipping cost to apply to the $30 of the other products (no discount applied to other products), to $25 (discount split between other products and packet-sku) or $20 (full discount applied only other products, not to packet-sku)? The example above uses the last Approach. If you use relative discounts, it is easier: Condition=contains_only(SKUs, "packet-sku"); Shipping=0
Variable=MyAmount; Value=AmountAfterCoupon*(Amount-evaluate_for_skus(Amount, "packet-sku"))/Amount
Name=Under $25; 0<=MyAmount<25; Shipping=4.50
... Basically, the issue is that VM calculates one coupon discount value for the whole cart, without any possibility to split it up to parts of the cart (in your case, Splitting the total coupon discount to packet-sku products and the rest of the cart). To make that split, you need to use some futher assumptions. Best regards, Reinhold |
|
I feel a little like Gandalf introducing the dwarfs to Beorn.
Now what if we want to have 2 SKUs in this variable? This is working great for our one SKU so far! Variable=MyAmount; Value=AmountAfterCoupon*(Amount-evaluate_for_skus(Amount, "packet-sku"))/Amount Now I need to add "course-renew" sku to this calculation. Would I just say Variable=MyAmount; Value=AmountAfterCoupon*(Amount-evaluate_for_skus(Amount, "NFP26-Affil", "course-renew"))/Amount |