removeProductsFromWishlist
Remove products from wishlist
Signature
declare function removeProductsFromWishlist(
context: Context,
input: MutationRemoveProductsFromWishlistArgs,
customQuery?: CustomQuery,
customHeaders?: CustomHeaders
): Promise<FetchResult<RemoveProductsFromWishlistMutation>>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
context | Required | Context | |
input | Required | MutationRemoveProductsFromWishlistArgs | |
customQuery | Optional | CustomQuery | |
customHeaders | Optional | CustomHeaders |
Referenced Types
- Context
- MutationRemoveProductsFromWishlistArgs
- CustomQuery
- CustomHeaders
FetchResultRemoveProductsFromWishlistMutation
Examples
import { sdk } from '~/sdk.config.ts';
const wishlist = await sdk.magento.removeProductsFromWishlist({
// Wishlist ID
id: '258',
// Products to remove from wishlist with given ID
items: ['258']
});Creating a custom GraphQL query for removing products from wishlist
module.exports = {
integrations: {
magento: {
customQueries: {
'remove-products-from-wishlist-custom-query': ({ variables, metadata }) => ({
variables,
query: `
mutation removeProductsFromWishlist($id: ID!, $items: [ID!]!) {
removeProductsFromWishlist(wishlistId: $id, wishlistItemsIds: $items) {
wishlist {
${metadata.fields}
}
}
}`
}),
},
}
}
}Using a custom GraphQL query (mutation) to remove products from wishlist
import { sdk } from '~/sdk.config.ts';
const customQuery = {
removeProductsFromWishlist: 'remove-products-from-wishlist-custom-query',
metadata: {
fields: 'id items_count'
}
};
const result = await sdk.magento.removeProductsFromWishlist({
id: '258',
items: ['258']
}, customQuery);
// Returned wishlist will contain only the fields specified in the custom query.