i am trying to set the cover of a product programmatically, by doing this for example;
[
"name" => "Example product"
"price" => [
0 => [
"currencyId" => "b7d2554b0ce847cd82f3ac9bd1c0dfca"
"gross" => 15
"net" => 10
"linked" => false
]
]
"manufacturer" => [
"name" => "Example manufacturer"
]
"tax" => [
"name" => "21%"
"taxRate" => 21
]
"stock" => 6235
"productNumber" => "PE-123123"
"coverId" => "4efd6bc156014cc2945b6351d3e9ff03"
]
I checked, and i am sure the media is uploaded. If i do it via the media as showed bellow, the media/image gets linked correctly.
"media" => [
"Id" => 'Example",
"mediaId" => "4efd6bc156014cc2945b6351d3e9ff03"
]
I don't understand why it is going wrong, as the documentation (https://docs.shopware.com/en/shopware-platform-dev-en/admin-api-guide/writing-entities#setting-the-cover) prescribes this way. A example in the documentation is the following;
{
"name": "test",
"productNumber": "random",
"stock": 10,
"taxId": "5f78f2d4b19f49648eb1b38881463da0",
"price": [
{ "currencyId" : "b7d2554b0ce847cd82f3ac9bd1c0dfca", "gross": 15, "net": 10, "linked" : false }
],
"coverId": "00a9742db2e643ccb9d969f5a30c2758"
}
You should pass cover media ID in the following way:
[
//other product data
"cover" => [
"mediaId" => "00a9742db2e643ccb9d969f5a30c2758"
]
]
For me, it works.