Apply coupon after calculate the shipping rate - woocommerce - php

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.

Related

How to set a shipping cost by item in Woocommerce

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.

How to make cart & checkout page calculation in opencart

Actually, i'm working on opencart 2.3, if now checkout page calculation in opencart:
Sub-Total₹ 1,520.00
India Shipping₹ 180.00
Discount (-07%)₹ -119.00
Total₹ 1,581.00
it s taking discount in shipping amount also i don't want discount shipping amount, i want calculation like this please help.
Sub-Total₹ 1,520.00
Discount (-07%)₹ -106.40
India Shipping₹ 180.00
Total₹ 1,593.60
you should change in admin>extensions>extensions>Order totals... sort order for the shipping. Move it down by changing sort order number higher than your discount voucher.

Magento calculate shipping to be refunded on partial refund

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?

Mangento - How to show Shipping fee in Subtotal but not calculated in Grand Total?

I am currently using Mangeto 1.9.1 and a custom shipping method which is the only one for my store.
Everything works cool but i want the shipping price to appear in the subtotal when order is created but to be not calculated in the Grand Total?
How i can show the shipping fee in subtotal but this fee must not be calculated and added in Grand Total ?
Thanks in advance!

WooCommerce shipping discount

I have a client that set up a site with WooCommerce and are processing tax exempt customers with a coupon code. The coupon applies a discount to amount using the same percentage as the sales tax essentially offsetting the amount.
the problem I have is they are also charging sales tax on shipping. The coupon will apply the discount to the items in the cart but not shipping. I need to make sure a discount is applied to shipping to offset the tax there is well.
This is my first time looking under the hood of WooCommerce and could use some advice.
My first step has been to start with the woocommerce_before_cart_table hook to get applied coupons and totals. Just not sure were to go from there.
Again, any advice is greatly appreciated.
I should also point out there is no budget or time to go in and do a full tax exemption plugin. (Although I believe I may when I have time)
Filter the shipping rates and remove the taxes for tax exempt buyers.
add_filter( 'woocommerce_package_rates', 'filter_rates_to_remove_taxes', 10, 2 );
public function filter_rates_to_remove_taxes( $rates, $package ) {
// if buyer is tax exempt remove taxes from rates //
return $rates;
}
And do tell client to pay for your services, he surely is out to make money with the site and you should treat this professionaly.

Categories