Skip to content

Commit d4c9467

Browse files
committed
Add Shopify API headers as a config to the SDK
1 parent a233b8d commit d4c9467

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,15 @@ The custom methods are specific to some resources which may not be available for
485485
- [current()](https://help.shopify.com/api/reference/user#current)
486486
Get the current logged-in user
487487

488+
### Shopify API features headers
489+
To send `X-Shopify-Api-Features` headers while using the SDK, you can use the following:
490+
491+
```
492+
$config['ShopifyApiFeatures'] = ['include-presentment-prices'];
493+
$shopify = new PHPShopify\ShopifySDK($config);
494+
```
495+
496+
488497
## Reference
489498
- [Shopify API Reference](https://help.shopify.com/api/reference/)
490499

lib/ShopifyResource.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ public function __construct($id = null, $parentResourceUrl = '')
149149
} elseif (!isset($config['ApiKey']) || !isset($config['Password'])) {
150150
throw new SdkException("Either AccessToken or ApiKey+Password Combination (in case of private API) is required to access the resources. Please check SDK configuration!");
151151
}
152+
153+
if (isset($config['ShopifyApiFeatures'])) {
154+
foreach($config['ShopifyApiFeatures'] as $apiFeature) {
155+
$this->httpHeaders['X-Shopify-Api-Features'] = $apiFeature;
156+
}
157+
}
152158
}
153159

154160
/**

0 commit comments

Comments
 (0)