assignCompareListToCustomer
assignCompareListToCustomer is a Magento 2 GraphQL mutation in the CompareList module. Assign the specified compare list to the logged in customer. It returns AssignCompareListToCustomerOutput and requires an Authorization header (Bearer customer token).
Last verified: against Magento 2.4.9.
Resolver class
\Magento\CompareListGraphQl\Model\Resolver\AssignCompareListToCustomer
Arguments
The unique ID of the compare list to be assigned.
Example request
Auto-generated from the SDL — paste-ready against your store's /graphql endpoint. Replace the host, store code, and any required values before running.
Headers
Query
mutation ($uid: ID!) {
assignCompareListToCustomer(uid: $uid) {
result
compare_list {
uid
items {
uid
product { ... }
attributes { ... }
}
attributes {
code
label
}
item_count
}
}
}Variables
{
"uid": ""
}Related in CompareListGraphQl
Other fields shipped by the same module.
addProductsToCompareList
Add products to the specified compare list.
CompareList · returns CompareList
compareList
Return products that have been added to the specified compare list.
CompareList · returns CompareList
createCompareList
Create a new compare list. The compare list is saved for logged in customers.
CompareList · returns CompareList
deleteCompareList
Delete the specified compare list.
CompareList · returns DeleteCompareListOutput
removeProductsFromCompareList
Remove products from the specified compare list.
CompareList · returns CompareList
Every Magento dev tool, in one hosted workspace.
Free to sign up. Nothing to install. Drafts, audits, and projects saved across every tool.