Shopware 6 API添加产品失败求助:请求必填字段说明
Fixing Required Fields for Shopware 6 Product Creation API
Looking at the error response you shared:
{"errors":[{"code":"c1051bb4-d103-4f74-8988-acbcafc7fdc3","status":"400","detail":"This value should not be blank.","template":"This value should not be blank.","meta":{"parameters":{"{{ value }}":"null"}},"source":{"pointer":"/0/productNumber"}}]}
The key clue here is the source.pointer pointing to /0/productNumber with the "should not be blank" message — productNumber is a required field you're missing in your request body.
Let’s break down the mandatory fields for the Shopware 6 POST /api/v1/product endpoint, plus fix a couple other potential issues in your current request:
Core Required Fields
productNumber: A unique identifier for your product (cannot be empty or duplicate existing numbers)name: Product name (you already have this covered)taxId: ID of the tax rule to associate (you included this correctly)stock: Inventory quantity (good to go)manufacturerId: ID of the linked manufacturer (you have this too)price: This needs to be a structured array, not a plain string. You’ll need to specify the currency and price values properly.
Corrected Request Body Example
{ "productNumber": "TEST-PROD-001", "stock": 1000, "taxId": "f6ac5dsvjbd7wd3b2i32bb89e2e802fc1a1e", "price": [ { "currencyId": "b7d2554b0ce847cd82f3ac9bd1c0dfca", // Replace with your store's actual default currency ID "gross": 100, "net": 83.33, // Optional: Can be auto-calculated based on tax, or set manually "linked": true } ], "name": "test", "manufacturerId": "72f26544ddfbb55eb3bwbt348ec0ea717" }
Extra Tips
- Double-check that
productNumberis unique across your entire Shopware instance — duplicates will throw another error. - Grab the correct
currencyIdfrom your Shopware admin under Settings > Currencies (it’s the UUID for your store’s default currency, e.g., GBP for your UK store). - If your store uses multiple languages, you can structure the
namefield for localization like:"name": { "en-GB": "Test Product", "de-DE": "Testprodukt" }
内容的提问来源于stack exchange,提问作者rajinder
相关产品推荐
相关产品推荐

