> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # RemoveProductMediaFromChoices # Package: catalogV1 # Namespace: CatalogWriteApi # Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/remove-product-media-from-choices.md ## Permission Scopes: Manage Products: SCOPE.DC-STORES.MANAGE-PRODUCTS ## Introduction Removes media items from all or some of a product's choices. (Media items can only be set for choices within one option at a time - e.g., if you set media items for some or all of the choices within the Colors option (blue, green, and red), you won't be able to also assign media items to choices within the Size option (S, M, and L).) --- ## REST API ### Schema ``` Method: removeProductMediaFromChoices Description: Removes media items from all or some of a product's choices. (Media items can only be set for choices within one option at a time - e.g., if you set media items for some or all of the choices within the Colors option (blue, green, and red), you won't be able to also assign media items to choices within the Size option (S, M, and L).) URL: https://www.wixapis.com/stores/v1/products/{id}/choices/media/delete Method: POST Method parameters: param name: media | type: array | description: Media to remove from choices. - name: option | type: string | description: Option name. - name: choice | type: string | description: Choice name. - name: mediaIds | type: array | description: Media GUIDs (available via the Query Product endpoint). Return type: RemoveProductMediaFromChoicesResponse EMPTY-OBJECT {} ``` ### Examples ### RemoveProductMediaFromChoices ```curl ~~~cURL curl -X POST \ 'https://www.wixapis.com/stores/v1/products/1044e7e4-37d1-0705-c5b3-623baae212fd/choices/media/delete' \ --data-binary '{ "option": "Color", "choice": "blue", "mediaIds": [ "9cc22d8b8d5244aba9ed73fb1783fc26.jpg", "fljseif3l4ij3l4ijl3r32fwfwf23234.jpg" ] }' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.catalogV1.CatalogWriteApi.removeProductMediaFromChoices(_id, media) Description: Removes media items from all or some of a product's choices. (Media items can only be set for choices within one option at a time - e.g., if you set media items for some or all of the choices within the Colors option (blue, green, and red), you won't be able to also assign media items to choices within the Size option (S, M, and L).) # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: _id, media Method parameters: param name: _id | type: string | description: Product GUID from whose choices to remove media items. | required: true param name: media | type: array | description: Media to remove from choices. | required: true - name: option | type: string | description: Option name. - name: choice | type: string | description: Choice name. - name: mediaIds | type: array | description: Media GUIDs (available via the Query Product endpoint). Return type: PROMISE EMPTY-OBJECT {} ``` ### Examples ### Remove media items from product choices ```javascript /************************************** * Backend code - products.web.js/ts * **************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { products } from '@wix/stores'; export const removeProductMediaFromChoices = webMethod(Permissions.Anyone, (_id, media) => { return products.removeProductMediaFromChoices(_id, media); }); /************* * Page code * *************/ import { removeProductMediaFromChoices } from 'backend/products.web'; // ... const _id = "1a11aaa3-...-111a1aaa111"; const media = [{ "option": "Color", "choice": "Blue" }]; removeProductMediaFromChoices(_id, media) .then(() => { // media items removed from the product choices }) .catch(error => { // media items not removed from the product choices }); ``` ### removeProductMediaFromChoices (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { products } from '@wix/stores'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { products }, // Include the auth strategy and host as relevant }); async function removeProductMediaFromChoices(_id,media) { const response = await myWixClient.products.removeProductMediaFromChoices(_id,media); }; ``` ---