Shipping refunds, which are based on what it originally cost to ship the return items, are calculated differently than other refund calculations. This value is not adjusted for changes in promotion values or the selected exchange items.
The Shipping Refund calculation, by default, distributes shipping costs evenly among all items within a shipping group. Commerce does not store a default value for shipping at the item level; however, if you have extended Commerce to calculate shipping based on item-specific values, you can incorporate that extension into the shipping share map calculation.
The shipping refund calculation API is accessible in ReturnManager
. Refer to ATG Platform API Reference for additional information:
protected void calculateShippingCostShare(ReturnRequest pReturnRequest)
protected Map calculateShippingCostShareMap(ReturnRequest pReturnRequest,
Order pOrder) throws ReturnException
protected double calculateShippingShareForRelationship(ReturnRequest
pReturnRequest, ShippingGroupCommerceItemRelationship
pShippingGroupCommerceItemRelationship, Map pRelsAlreadyCalculated)
The ShippingCostMap
is accessible in the ReturnRequest
:
public Map getShippingCostMap()
public void setShippingCostMap(Map pShippingCostMap)
The shipping share value is calculated for each ShippingGroupCommerceItemRelationship
in the Original Order. The relationshipId
is mapped to the shared amount and is used to calculate shipping refund value for each returned item.