Legacy Knowledge Base
公開されました Jun. 30, 2025

ヘッドレスAPIでSKUを2回更新することができない。

Written By

Pooja Bhambani

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

問題

  • 再現するための手順
    1. Liferay DXP 7.4 を起動します。
    2. minium site templateを使用してサイトを作成します。
    3. City」という名前のオプションを作成します。
    4. segment "という名前の仕様を作成します。
    5. localhost:8080/o/api に移動します。
    6. http://localhost:8080/o/api?endpoint=http://localhost:8080/o/headless-commerce-admin-catalog/v1.0/openapi.json
    7.選択します。 POST/商品を作成する(リクエストは添付されています)。 注) catalogidとoptionidは環境に応じて変更してください。
    8. 提供されたSKUで製品が正常に作成されます。
    9. 再度、同じ製品を作成し、今度はSKU、価格、 & コスト値を変更します。
    予想される結果: 2回目には、商品の価格を変更する必要があります。
    実際の結果: リクエストを実行中に無効なSKUを返した。

Environment

  • Liferay DXP 7.4
  • コマース4.0

解決策

  • 商品のSKUを更新するためには、まず「ERC」を定義して、どの商品を更新する必要があるのかをリクエストに知らせる必要があります。
  •  "skus": [
    {
    "cost": 1900000,
    "depth": 0,
    "discontinued": false,
    "discontinuedDate": "2023-03-15T10:08:25.198Z",
    "displayDate": "2023-03-15T10:08:25.198Z",
    "expirationDate": "2023-03-15T10:08:25.198Z",
    "externalReferenceCode": "AB-34098-789-N1",
    "gtin": "12341234",
    "height": 0,
    "manufacturerPartNumber": "12341234",
    "neverExpire": true,
    "price": 1900000,
    "promoPrice": 1900000,
    "published": true,
    "purchasable": true,
    "replacementSkuExternalReferenceCode": "SKU0111",
    "replacementSkuId": 33135,
    "sku": "Compass-Delhi",
    "skuOptions": [
    {
    "key": "city",
    "value": "delhi"
    }
    ],
    "unspsc": "1234567890",
    "weight": 1.1,
    "width": 20.2
    }
    ]

追加情報

Did this article resolve your issue ?

Legacy Knowledge Base