Shopware 6 产品 API 未设置购买价格

Shopware 6 Product API doesn't set the buying price

在 Shopware 6 中,我仍然尝试使用 API 将产品放入系统。
我现在得到了一个产品,但它没有价格,尽管我插入了它。
这实际上会导致产品没有价格并阻止后端加载产品,因此我必须使用导出、编辑然后导入方法手动更改价格。
在将产品对象作为请求发送到 API.

之前,产品对象也会使用 json_encode 进行编码 我似乎无法找出以下代码有什么问题:

$price = [
    "currencyId" => "b7d2554b0ce847cd82f3ac9bd1c0dfca",
    "net" => $net,
    "gross" => $gross,
    "linked" => false
];
$price = json_encode($price);
$product = [
    "id" => str_replace("-","", $productId),
    "productId" => str_replace("-","", $productId),
    "name" => $name,
    "taxId" => $taxId,
    "productNumber" => $productNumber,
    "minPurchase" => $minPurchase,
    "price" => $price,
    "purchasePrice" => $purchasePrice,
    "stock" => $stock,
    "images" => $images,
    "atributes" => $atributes,
    "categoryId" => "7997459a37f94a75a14d7cbd872a926f"
];

我不得不这样写代码:

$product = [
    "id" => str_replace("-","", $productId),
    "productId" => str_replace("-","", $productId),
    "parentId" =>str_replace("-","", "4307a3d9afee4b46b3da1a8fc6230db5"),
        "name" => $name,
        "taxId" => $taxId,
        "productNumber" => $productNumber,
        "minPurchase" => $minPurchase,
        "price" => [[
            "currencyId" => "b7d2554b0ce847cd82f3ac9bd1c0dfca",
            "net" => $net,
            "gross" => $price,
            "linked" => true
        ]],
        "purchasePrice" => $purchasePrice,
        "stock" => $stock,
        "description" => $description,
        "images" => $images,
        "atributes" => $atributes,
        "categoryId" => "7997459a37f94a75a14d7cbd872a926f"
];