medusajs / medusa

Building blocks for digital commerce
https://medusajs.com
MIT License
24.31k stars 2.37k forks source link

Medusa Admin: Manual order creation UI inconsistencies (item quantity & metadata) #4785

Open barnabycollins-s2z opened 1 year ago

barnabycollins-s2z commented 1 year ago

Bug report

Describe the bug

Hey there - just wanted to report that I'm seeing two slight issues during the manual draft order creation flow in Medusa Admin v6.0.4. These don't hugely affect the usage of the admin console, but it could cause confusion.

Firstly, the summary at the end of the draft order creation process displays the incorrect item quantities for any items that had their quantities typed rather than entered using the +/- buttons. I believe this bug has been in the admin console for quite some time, as I'd seen it on previous versions too.

Secondly, the metadata entry field in the order creation process doesn't allow the user to directly populate the 'Key' field. Instead, the Key field duplicates whatever is in the Value field.

System information

Medusa version (including plugins):

    "@medusajs/admin": "6.0.4",
    "@medusajs/cache-redis": "1.8.8",
    "@medusajs/event-bus-redis": "1.8.9",
    "@medusajs/medusa": "1.13.0",
    "@medusajs/medusa-cli": "1.3.17",
    "medusa-core-utils": "1.2.0",
    "medusa-fulfillment-manual": "1.1.38",
    "medusa-interfaces": "1.3.7",
    "medusa-payment-manual": "1.0.24",
    "medusa-plugin-sentry": "1.4.2",

Node.js version: 18 Database: Postgres Operating system: Linux Browser (if relevant): Firefox 116.0.2 (also observed by others using Chrome)

Steps to reproduce the behavior

For the product quantity problem:

  1. Start creating a draft order in the admin UI
  2. Add some products
  3. The products will appear with quantity of 1 for an existing product, or whatever you selected if a custom product:

image

  1. Click on the quantity of some product(s) and type in some new quantity

image

  1. Complete the order creation process and note that it does not show the typed quantity/quantities

image

  1. Save the draft order and observe that the save operation did observe the typed quantity/quantities

image

For the metadata problem:

During the 'Customer and shipping details' or 'Billing Address' step of the draft order creation process, try to edit the metadata. The key field cannot be typed in, and typing in the Value field populates both Key and Value with the same data simultaneously.

Expected behavior

Draft order summary shows the correct product counts, and the metadata can be populated as expected

Thanks for all your hard work! :)

kenchoong commented 1 month ago

ya same problem in here https://github.com/medusajs/medusa/issues/5764#issuecomment-2214702602

i need the metadata to store the data from other service since i unable to do that, I add in 2 fields in draft order entity, migrations created and run but when I call to POST /admin/draft-order, the 2 new fields is unable to insert, which is expected, fine.

So I try to extend the API routes, use a custom endpoint, but I figure out, underneath, the endpoint is using workflows to createOrdersWork flow, which is in the code here

Ok, then I thought to create a endpoint, which will do the same thing, that will manually createOrderWorkflow as the code above, but I also cant, because I cant import the createOrdersWorkflow function into my file.

so basically, I left 1 option I need to create a new API route, use repository from typeorm, to achieve basically the same thing