How to set a shipping cost by item in Woocommerce - php

In Woocommerce, when I add multiple products in cart, the shipping only applies to to 1 product. How should I change that to apply the cost to each item?
Like in the following image, the shipping cost for printer is applied but the LCD monitor is not.
How to set a shipping cost by item in Woocommerce?

In the Woocommerce Shipping Settings for "Flat rate" Shipping Method, there is many ways to get dynamic settings based on:
Item quantity, using [qty] argument
Total item cost, using [cost] argument
A fee, using [fee] argument with additional parameters percent, min_fee and max_fee
You can also use +, -, * and / operators and parenthesis.
Here are some example:
[qty]*2 - Cost by item
4+([qty]*2.5) - Initial cost with an additional cost by item
[fee percentage='10' min_fee='' max_fee='20'] - Percentage fee limited to a max amount
[fee percentage='10' min_fee='4' max_fee=''] - Percentage fee with a minimal cost
Related thread: Set Minimum item cost in Woocommerce Shipping method rates
Advanced shipping cost customizations:
It's possible to customize even more shipping costs using woocommerce_package_rates filter hook.
See all StackOverFlow related threads using woocommerce_package_rates filter hook.

Related

Apply coupon after calculate the shipping rate - woocommerce

I am building my website by using woocommerce, but i faced the problem of calculating the total amount of the order.
There is a shipping method which is 15% additional fee of the order, and there is a coupon offers $10 discount.
But woocommerce seems like apply the coupon before calculate shipping fee.
For example, the order total amount is $100, the expected result should be (100*1.15) - 10 = 105, but when i tested in the checkout page, the total amount is (100-10) * 1.15 = 103.5.
May I know how to apply the coupon after calculate the shipping fee?
Thank you.
I want to calculate amount correctly in woocommerce, which is apply coupon after calculate the shipping fee.

Progressive Flat rate shipping method based on item quantity in Woocommerce

I Would like to add different progressive flat rates shipping cost for 2 different shipping Zones domestic and international: A fixed amount for the first item and an additional cost for every additional items.
eg: Standard domestic postage $10, and $20 international, with $5 additional for each extra item.
Is this possible through woocommerce shipping setting? or this need some custom coding?
Any help is appreciated.
You can use the following cost line that will give you a fixed cost + an additional cost by item. This need to be differently for each shipping zone.
For your "Domestic" shipping Zone, use: 5+([qty]*5) So the first item will be at 10 (5+5) and each additional item will add +5 to the cost.
For your "International" shipping Zone, use: 15+([qty]*5) So the first item will be at 20 (15+5) and each additional item will add +5 to the cost..

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$

Add additional fee on the total shipping fee

Is there a way (a snippet) to add an extra fee on the total shipping fee. Want to add an extra $1.00 (for box cost) on the total shipping fee.
Instead of making it visible on front-end I just want to make that extra fee hidden and add it on the total shipping cost.
Say
Subtotal : $5.00
Shipping : $3.00 (total shipping is $2.00 + my extra $1.00 fee)
Total = $8.00
If you prefer not to use a plugin, it looks like you will need to edit includes/class-wc-shipping.php Line 317.
It appears that $this->shipping_total += $rate->cost; on Line 317 calculates the shipping total on a per-package basis (this is in a loop).
After the loop completes, you'll need to add your fee:
The code added on Line 327, $this->shipping_total += 1;, adds an additional, hidden fee to the total cost.
To add a hidden fee to the shipping line item, edit includes/class-wc-cart.php Line 1387 from:
To...
This accounts for the AJAX call that drives shipping cost calculation.
It looks like the WooCommerce Extra Fee Options PRO plugin fills this need, so yes it is possible.

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.

Categories