-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upsert Media with Product #88
Comments
Please have a look into the media usage in the product entity. The You can create "images" for a product in one upsert: [
'id' => '018cf59aa9d870008000fbc39f0fcef2',
'name' => 'New Product',
'taxId' => '018de63f1b61715aad18389bfaddf6ba',
'price' => [...],
'productNumber' => 'FRE832672',
'stock' => 2,
'media' =>
[
'id' => '6bcc6ff17506417ebd0d11509ee98471',
'position' => 1,
'media' =>
[
'id' => '6e72218deae348cdb828b1c4e397efdd'
'url' => 'https://image.shutterstock.com/image-photo/stock-photo-woman-with-static-electric-hair-isolated-on-black-background-250nw-2014152446.jpg'
]
],
'coverId' => '6bcc6ff17506417ebd0d11509ee98471'
] Something like that should work. The media ID (not product media ID) can be left out and will be generated automatically as far as I know (beware of update operations on collections: there is an explanation in the Admin API documentation). However, you should generate the product media ID by yourself because you want to use it as a reference. It might be possible that something like this is also working: [
'id' => '018cf59aa9d870008000fbc39f0fcef2',
'name' => 'New Product',
'taxId' => '018de63f1b61715aad18389bfaddf6ba',
'price' => [...],
'productNumber' => 'FRE832672',
'stock' => 2,
'cover' =>
[
'id' => '6bcc6ff17506417ebd0d11509ee98471',
'position' => 1,
'media' =>
[
'id' => '6e72218deae348cdb828b1c4e397efdd'
'url' => 'https://image.shutterstock.com/image-photo/stock-photo-woman-with-static-electric-hair-isolated-on-black-background-250nw-2014152446.jpg'
]
]
] Don't forget that you have to do the file upload separately! This is done via Action API. Otherwise only the |
Is it possible to upsert a media file with a product upsert? Either as a separate payload in the same request or directly via the product upsert?
We have about 10k articles with images I want to sync. Optimal strategy would be to only update the image if the article is created (normally they don't change) and of course do everything in one go (like 100 products at a time).
What I have until now:
adding a property like
doesn't work...
The text was updated successfully, but these errors were encountered: