medusajs / medusa

The world's most flexible commerce platform.
https://medusajs.com
MIT License
26.25k stars 2.67k forks source link

Cart total calculated inside the Swap's Cart is calculating prices of the return items as well as exchanging items rather calculating the difference between them. #7653

Closed RonakPanchal2 closed 1 month ago

RonakPanchal2 commented 5 months ago

Bug report

Describe the bug

Created swap object is having difference_due property still null even when products being exchange are having different prices and the Swap's cart total calculated is including the price of the returning item, plus the new item being exchanged and the shipping option which is counted as an item in swap cart.

System information

Medusa version (including plugins): "@medusajs/admin": "7.1.14", "@medusajs/medusa": "1.20.6", "@medusajs/utils": "^1.11.6", "medusa-core-utils": "^1.2.1", "medusa-file-r2": "^0.0.2", "medusa-fulfillment-manual": "^1.1.39", "medusa-fulfillment-shiprocket": "^0.1.0", "medusa-interfaces": "^1.3.8", "medusa-payment-manual": "^1.0.24", "medusa-payment-razorpay": "7.0.5",

Node.js version: v20.11.0

Database: postgresql Operating system: Windows Browser (if relevant): Chrome

Steps to reproduce the behavior

  1. Make a POST request to /store/swaps with the required data in response you will get an swap object
  2. Inside swap object see the difference_due property it will be null even if the products being exchanged have different prices
  3. Load the swap cart data by making Get request to store/carts/{id} Here you will see items available inside the cart and one item will be of the shipping option you provided for the return when creating a swap
  4. You can see the cart's total is being calculated by adding all items price even if an item has is_return property as true

Expected behavior

I was expecting the difference_due value should not be null rather 0 but is null and the cart total must have been calculated only if there is any extra amount the customer has to pay

Screenshots

Cart page screenshot Screenshot 2024-06-07 182306 Swap object created is having difference_due value as null

Screenshot 2024-06-07 183047

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 3 days.

github-actions[bot] commented 1 month ago

This issue was closed because it has been stalled for 3 days with no activity.