how to add package weight to total cart weight in woocommerce? - php

How to add package weight to total cart weight in woocommerce?
For example total weight of cart is 1800 g and the package weight is 400 g, then the shipping plugin calculates the weight as 1800 g, but the real weight of package which being used by shipping company is 2200 g.
Then the seller must pay this additional fee(for 400g) from his own pocket.
Is there any solution?
How can I use $cart_contents_weight ?

I had the same problem and didn't find any official solution. But there is an easy hack for the system, set the weight limits lower with the package weight!
I.e. if the price range limits are 1000 and 2000 grams, set 600 and 1600 grams instead. Using this method, an order of 1800 g will be already in the second range, where it should be.
Unfortunately, if the package weight varies, this method isn't perfect. I'm selling small goods in the same small parcels so I deducted 60 grams from each weight limit and the system works fine for me.

Related

Prestashop discount to increase total cart price

It's sounds a kind weird but I need to use a Prestashop 1.7 discount based on transportation id = 1 to increase 20% over cart's total.
I don't know where the function is and where to place...
You need to find module. For example Cash on Delivery with fee.

How to increase shipping cost depending on quantity of order?

Pretty much I want to increase the shipping cost depending on the number of items in order... e.g. by default shipping cost is 10$ but when number items goes beyond 20 it will add 3$ to shipping cost so it would be 13$
I tried changing codes but it's complicated somehow
I had to find all places that include shipping tax like in 1-blockcart module, 2-one page checkout, 3-payment, 4-inserting to database... And then change some codes. And it's a lot of work and hard
Prestashop includes a shipping range functionality. You can define shipping cost depending of the total weight of your products.
If you want a simple implementation, you can define all your products weight to 1Kg and add shipping cost ranges like those:
0kg => 20kg : 10$
20kg => 40kg : 13$
40kg => 99999kg : 15$

woocommerce/wordpress set maximum cart total

I can't find any plugins that allow me to set rules I need to cart.
I found plugins which allow to set rules that let you set max/min purchases (only calculates total of products) but doesn't take into account total price of products+fees+shipping (total cart).
Anyone know any solutions?
Thank you.
As advised I can answer my own question.
First off my query was about setting maximum price allowed to a cart total, not just product total.
eg.max Total products+shipping+fees=100
Here's the solution:
I found a plugin called min "Min and Max Purchase for WooCommerce".If you set your fee (if you have that implemented) and shipping to static eg. $1 fee and $1 shipping all the time.
You can then set maximum total price of products to [desired maximum price to set - (static shipping cost+ static fee)= total max price to set for products]
From example on top deired maximum [$100 desired maximum total-($1 shipping+$1 fee)=$98 total max price to set for products]
This will only work for your eCommerce website IF your shipping cost are static and not affected by weight of products.

How to change Shipping Cost per two product in woocommerce?

I am using woocommerce plugin in a wordpress site.
The shipping method is to be calculated on the basic of USPS Priority 1-Day mail $5.75 per pound (lbs).
Each shirt ways 1/2 a pound in weight, so 2 shirts should not be charged additional shipping.
Means I want to calculate the shipping method for per two shirt i.e. $5.75 not as cost per product.
then the shipping will be calcalated as like ths
3 -4 shirts $11.50 and 5 shirts $17.25 etc...
The basic requirement is if I would be able to change the shipping cost per product to per two product the query will be solved. How Can I get this method.
Any help will be appreciated.

Tax calculation issue for a plugin

i am working on a plugin for prestashop, i am done with it, but i have stumbled on to an issue.
The program flow is as follows:
A person places an order at the eCommerce website, the order is accepted, the order details such as items, prices, taxes, discounts etc is send to an external invoice API service.
An example of an order could be:
(These prices include taxes)
1x T-shirt 20.64
1x Shipping 125
1x Discount -18.58
(In this particular test case, the discount is 90% off the product, the math is simple 20.64 * 0.90 = 18.58)
Order total after tax is applied: 127.06
This is all fine, but, when i send the details off to the API, the order is saved as the following:
(These prices are saved without tax applied, the tax rate being 25%)
1x T-shirt 16.51
1x Shipping 100
1x Discount -14
Order total after tax is applied: 128.14
As you see, the order totals do not mach, the difference is 1.08, i am thinking this a discount & tax issue.
Its worth noting that the external site does its own math on the values sent, e.g products, tax etc. I cannot influence the way the external invoicing site does its calculations. I think the issue occurs in the order of which the operations are performed on the different platforms.
Its also worth mentioning that the code works perfectly fine when there is no discount present.
What can i do prior to sending the values, so that i get the prestashop price at the external service?
Let the value of the items be v_1 (t-shirt), v_2 (shipping) untaxed values, respectively.
Case 1.
1.25*v_1+1.25*v_2-0.9*1.25*v_1 = 127.06
Case 2 (tax at end)
(v_1+v_2-0.9*v_1)*1.25 = Same as Case 1 after expanding the brackets.
The figure which is amiss is, as you suggest, the -14 discount, which is more like -0.9*16.51=-14.86.
1.08 difference
There is a difference of 86 cents/pence, whatever, between the untaxed discount values. After taxes this difference grows to, 0.86*1.25=1.08, which explains the discrepancy.
To fix the code, the discount calculation needs to be fixed, unless there are other tax considerations that apply to discounts, etc. In other words why is -14 being used, rather than -14.86?
To you second point about the order of events, this should not impact anything - unless discounts are taxed differently.
Fix
Either
The discount calculation is wrong (i.e. 14 should be 14.86), or
The discount value of 14 is correct, in which case a different (tax/discount) methodology than what is being assumed and this needs to be ascertained before you can make a fix for it.

Categories