medusajs / medusa

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

Fail to import or export the products with available stocked inventory #9357

Open jxpeng98 opened 3 weeks ago

jxpeng98 commented 3 weeks ago

Bug report

Describe the bug

I tried to import a product list with the downloaded import templates provided by admin dashboard product-import-template, and official docs product-import-sales-channels.

In the v2 backend, The column Variant Inventory Quantity cannot be recognised when importing.

image

It will always return zero inventory.

image

If I adjust the inventory via the dashboard, the inventory quantity cannot be exported into the CSV file.

image

From the dashboard JSON section, the stock quantity has not been recorded.

[
  {
    "id": "variant_01J8TS7CH36R8RV71AW1VJNPZ0",
    "title": "Test variant",
    "sku": "test-sku1",
    "barcode": "test-barcode1",
    "ean": null,
    "upc": null,
    "allow_backorder": false,
    "manage_inventory": true,
    "hs_code": null,
    "origin_country": null,
    "mid_code": null,
    "material": null,
    "weight": null,
    "length": null,
    "height": null,
    "width": null,
    "metadata": null,
    "variant_rank": 0,
    "product_id": "prod_01J8TS7BBC9FGYAK6CH5Y4WREH",
    "created_at": "2024-09-27T22:22:04.836Z",
    "updated_at": "2024-09-27T22:22:04.836Z",
    "deleted_at": null,
    "options": [
      {
        "id": "optval_01J8TS7BVVVNZC0S9STVY0096Q",
        "value": "option 1 value 1",
        "option_id": "opt_01J8TS7BPTC1PM0QNF2X169N1X",
        "option": {
          "id": "opt_01J8TS7BPTC1PM0QNF2X169N1X",
          "title": "test-option-1",
          "product_id": "prod_01J8TS7BBC9FGYAK6CH5Y4WREH",
          "product": {
            "id": "prod_01J8TS7BBC9FGYAK6CH5Y4WREH",
            "title": "Test product",
            "handle": "test-product-product-1",
            "subtitle": null,
            "description": "test-product-description-1",
            "is_giftcard": false,
            "status": "published",
            "thumbnail": null,
            "weight": null,
            "length": null,
            "height": null,
            "width": null,
            "origin_country": null,
            "hs_code": null,
            "mid_code": null,
            "material": null,
            "collection_id": null,
            "collection": null,
            "type_id": "ptyp_01J8TQ6SEAQVV1TY0XAWZ47CG9",
            "discountable": true,
            "external_id": null,
            "created_at": "2024-09-27T22:22:02.147Z",
            "updated_at": "2024-09-27T22:22:02.147Z",
            "deleted_at": null,
            "metadata": null,
            "type": {
              "id": "ptyp_01J8TQ6SEAQVV1TY0XAWZ47CG9",
              "value": "test-type",
              "metadata": null,
              "created_at": "2024-09-27T21:46:48.138Z",
              "updated_at": "2024-09-27T21:46:48.139Z",
              "deleted_at": null
            },
            "tags": [
              {
                "id": "ptag_01J8TQ70GYQYSAD6PGVR7319VB",
                "value": "123",
                "metadata": null,
                "created_at": "2024-09-27T21:46:55.391Z",
                "updated_at": "2024-09-27T21:46:55.391Z",
                "deleted_at": null
              }
            ],
            "images": [],
            "categories": []
          },
          "metadata": null,
          "created_at": "2024-09-27T22:22:02.147Z",
          "updated_at": "2024-09-27T22:22:02.147Z",
          "deleted_at": null
        },
        "metadata": null,
        "created_at": "2024-09-27T22:22:02.147Z",
        "updated_at": "2024-09-27T22:22:02.147Z",
        "deleted_at": null
      },
      {
        "id": "optval_01J8TS7BVWQPB2KGJMVJZPVBN7",
        "value": "option 2 value 1",
        "option_id": "opt_01J8TS7BPVAQ8WTD70GJVTZ7Q6",
        "option": {
          "id": "opt_01J8TS7BPVAQ8WTD70GJVTZ7Q6",
          "title": "test-option-2",
          "product_id": "prod_01J8TS7BBC9FGYAK6CH5Y4WREH",
          "product": {
            "id": "prod_01J8TS7BBC9FGYAK6CH5Y4WREH",
            "title": "Test product",
            "handle": "test-product-product-1",
            "subtitle": null,
            "description": "test-product-description-1",
            "is_giftcard": false,
            "status": "published",
            "thumbnail": null,
            "weight": null,
            "length": null,
            "height": null,
            "width": null,
            "origin_country": null,
            "hs_code": null,
            "mid_code": null,
            "material": null,
            "collection_id": null,
            "collection": null,
            "type_id": "ptyp_01J8TQ6SEAQVV1TY0XAWZ47CG9",
            "discountable": true,
            "external_id": null,
            "created_at": "2024-09-27T22:22:02.147Z",
            "updated_at": "2024-09-27T22:22:02.147Z",
            "deleted_at": null,
            "metadata": null,
            "type": {
              "id": "ptyp_01J8TQ6SEAQVV1TY0XAWZ47CG9",
              "value": "test-type",
              "metadata": null,
              "created_at": "2024-09-27T21:46:48.138Z",
              "updated_at": "2024-09-27T21:46:48.139Z",
              "deleted_at": null
            },
            "tags": [
              {
                "id": "ptag_01J8TQ70GYQYSAD6PGVR7319VB",
                "value": "123",
                "metadata": null,
                "created_at": "2024-09-27T21:46:55.391Z",
                "updated_at": "2024-09-27T21:46:55.391Z",
                "deleted_at": null
              }
            ],
            "images": [],
            "categories": []
          },
          "metadata": null,
          "created_at": "2024-09-27T22:22:02.147Z",
          "updated_at": "2024-09-27T22:22:02.147Z",
          "deleted_at": null
        },
        "metadata": null,
        "created_at": "2024-09-27T22:22:02.147Z",
        "updated_at": "2024-09-27T22:22:02.147Z",
        "deleted_at": null
      }
    ],
    "prices": [
      {
        "id": "price_01J8TS7D9AFBMPAPQZKD6FQ9BN",
        "amount": 110,
        "currency_code": "gbp",
        "min_quantity": null,
        "max_quantity": null,
        "variant_id": "variant_01J8TS7CH36R8RV71AW1VJNPZ0",
        "created_at": "2024-09-27T22:22:05.614Z",
        "updated_at": "2024-09-27T22:22:05.614Z",
        "rules": {}
      }
    ]
  }
]

There is no inventory quantity column in the CSV file.

image

System information

Medusa version (including plugins): 1.20.6-preview-20240925143312 Node.js version: v22.4.1 Database: Neon Operating system: Debian 12 Browser (if relevant): Chrome

Steps to reproduce the behavior

  1. Go to dashboard products
  2. Click on import with csv template
  3. Refresh and inventory will be zero.
  4. See error

Expected behavior

How can this problem be solved?

sradevski commented 2 weeks ago

Hi there, we'll look into it, thanks for opening a ticket.