Magento calculate shipping to be refunded on partial refund - php

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?

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.

eBay API to get Total Amount using GetOrders by PHP

Right now, I am using GetOrders to launch all my orders to my database. Normally, it works fine. I can get the total amount(includes item price and tax) by using:
$totalAmount = $order->AmountPaid;
However, when I tried to import an International Order, the amount was wrong.
The thing is: I only charged him $102.90, but the amount here gives me $157.62
Does anyone know how can I get the total price, which under the "Total" column, in eBay? What kind of value I need to use? Or maybe how to calculate the price for international order?
There few fields related to order price
OrderArray.Order.AmountPaid
This value indicates the total amount of the order. This amount includes the sale price of each line item, shipping and handling charges, shipping insurance (if offered and selected by the buyer), additional services, and any applied sales tax. This value is returned after the buyer has completed checkout (the CheckoutStatus.Status output field reads 'Complete').
OrderArray.Order.Total
The Total amount equals the Subtotal value plus the shipping/handling, shipping insurance, and sales tax costs.
OrderArray.Order.Subtotal
The subtotal amount for the order is the total cost of all order line items. This value does not include any shipping/handling, shipping insurance, or sales tax costs.
I would suggest you try Order.Total for receive price of the order.

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.

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!

Different shipping amounts based on total amount of order in ubercart

is there an option to offer different shipping amounts based on the total amount of the order in Ubercart ? An example would be the following, if the order totaled:
0-$50 then shipping would be $50
$50-$100 then shipping would be $125
$100-$500 then shipping would be $1000
I don't think there is any specific option for that, but in MARKUPS you can choose the percentage, which may give a close result of what you need.

Categories