This module adds GraphQL tokens to the CustomerData sections to enable GraphQL calls from a Magento template.
Compatible with Magento 2.3.4 and higher.
It adds:
signin_token
to thecustomer
sectioncartId
to thecart
sectionstoreViewCode
to thecart
section
The CartId is the masked cartId
that is needed for guest carts. The storeViewCode
is needed to set the store-code on GraphqQl requests.
When logged in, the customer signin_token
can be used to get the real cart id.
- Install via composer
composer config repositories.hyva-themes/magento2-graphql-tokens git [email protected]:hyva-themes/magento2-graphql-tokens.git composer require hyva-themes/magento2-graphql-tokens
- Enable module
bin/magento setup:upgrade
No configuration needed.
There are after-plugins
that add the tokens to the individual sections.
If a token already exists, it uses the existing one. Otherwise, a fresh token is generated on the fly.
The MIT License (MIT). Please see License File for more information.