@@ -149,7 +149,9 @@ class ShopifySDK
149
149
*
150
150
* @var array
151
151
*/
152
- public static $ config = array ();
152
+ public static $ config = array (
153
+ 'ApiVersion ' => '2019-04 '
154
+ );
153
155
154
156
/**
155
157
* List of available resources which can be called from this client
@@ -225,8 +227,7 @@ class ShopifySDK
225
227
public function __construct ($ config = array ())
226
228
{
227
229
if (!empty ($ config )) {
228
- ShopifySDK::$ config = $ config ;
229
- ShopifySDK::setAdminUrl ();
230
+ ShopifySDK::config ($ config );
230
231
}
231
232
}
232
233
@@ -315,13 +316,14 @@ public static function setAdminUrl()
315
316
316
317
//Remove https:// and trailing slash (if provided)
317
318
$ shopUrl = preg_replace ('#^https?://|/$# ' , '' , $ shopUrl );
319
+ $ apiVersion = self ::$ config ['ApiVersion ' ];
318
320
319
321
if (isset (self ::$ config ['ApiKey ' ]) && isset (self ::$ config ['Password ' ])) {
320
322
$ apiKey = self ::$ config ['ApiKey ' ];
321
323
$ apiPassword = self ::$ config ['Password ' ];
322
- $ adminUrl = "https:// $ apiKey: $ apiPassword@ $ shopUrl/admin/ " ;
324
+ $ adminUrl = "https:// $ apiKey: $ apiPassword@ $ shopUrl/admin/api/ $ apiVersion / " ;
323
325
} else {
324
- $ adminUrl = "https:// $ shopUrl/admin/ " ;
326
+ $ adminUrl = "https:// $ shopUrl/admin/api/ $ apiVersion / " ;
325
327
}
326
328
327
329
self ::$ config ['AdminUrl ' ] = $ adminUrl ;
0 commit comments