Now I'm trying to apply a coupon to the cart and I followed this link: applyCouponToCart mutation

But we don't get the mask id when customer is logged in, so how to get mask id for logged in customer. Otherwise what is other option for logged in customer ?

  • As per this documentation rakeshjesadiya.com/masked-id-fro-cart-id-magento-2 the mask id will only be available for guest users. Jul 28, 2022 at 5:15
  • yes i have checked that link but i now i got mask id using by graphql query for logged in customer.
    – user101695
    Jul 28, 2022 at 7:55

1 Answer 1


Magento has provided get customer cart id(mask id). So if you want to get current customer mask id run below query and check.

  customerCart {

And also pass in header customer token.

   "Authorization": "Bearer zcnj8wd03u19s5fw1yvkprs23du7tfkh"

Let me know if any query.


Also we face same issue some time as you are facing. For this you need to login into magento side in same browser tab. So, your GraphQl query will found current user data.


  • Hello @mohit, i have got the cart id, but after i send request to "applyCouponToCart mutation" it's throw error "The current user cannot perform operations on cart". any help in this ?
    – user101695
    Jul 28, 2022 at 7:54
  • Check this link github.com/magento/magento2/issues/32785 Jul 28, 2022 at 8:59
  • It's not working in 2.4.3 version.
    – user101695
    Jul 28, 2022 at 11:01
  • Can you check my Updated answer Jul 28, 2022 at 14:19
  • Yes, i have checked your answer and it's working for me.
    – user101695
    Jul 29, 2022 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.