Header Key and Value graphql query postman
// enter header key as 'Store' and value as store code e.g in
Store - in
// enter header key as 'content-currency' and value as store code e.g AED
content-currency - AED
<?php
declare(strict_types=1);
namespace Vendor\Module\Model\Resolver;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
class ExampleClass implements ResolverInterface
{
/**
* @inheritdoc
*/
public function resolve(
Field $field,
$context,
ResolveInfo $info,
array $value = null,
array $args = null
) {
// get store and currency from graphql
$store = $context->getExtensionAttributes()->getStore();
$currency = $store->getCurrentCurrencyCode();
$store = $store->getCode();
$data = $offer->getData();
$data['model'] = $offer;
return ['offer' => 'test data'];
}
}