JavaScript
import Medusa from "@medusajs/js-sdk" export const sdk = new Medusa({ baseUrl: import.meta.env.VITE_BACKEND_URL || "/", debug: import.meta.env.DEV, auth: { type: "session", }, }) sdk.admin.product.batchVariantImages("prod_123", "variant_123", { add: ["img_123", "img_456"], remove: ["img_789"] }) .then(({ added, removed }) => { console.log(added, removed) })
200
Example
{ "added": [ "<string>" ], "removed": [ "<string>" ] }
Manage the association between product images and a product variant. You can add or remove associations between images and the variant.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bearer <token>
<token>
The product's ID.
The product variant's ID.
Details of the associations between images and a product variant to manage.
The IDs of product images to add to the variant.
The ID of the image to add.
The IDs of product images to remove from the variant.
The ID of the image to remove.
OK
Result of managing the associations between images and a product variant.
The IDs of product images added to the variant.
The ID of the image added.
The IDs of product images removed from the variant.
The ID of the image removed.