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.
Related
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.
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.
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..
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$
I'm trying to figure out how to calculate the shipping refund on orders where some of the items are being refunded. Currently, in the credit memo screen, the amount in the input field is the total amount paid for shipping. When you adjust the quantity of items being refunded, and hit update, the shipping refunded amounts stays the same. I'd like to adjust it to be the portion of shipping that is related to the items being refunded.
As a calculation, I was thinking this would be:
total shipping cost - new calculation of shipping for items not being refunded = shipping cost of items being refunded.
I can see that the calculation for shipping is done in this class:
Mage_Sales_Model_Order_Creditmemo_Total_Shipping
However, I am having trouble figuring out how I would rerun the shipping calculation for the credit memo items.
Anyone have any thoughts on how I might be able to accomplish this?