@@ -149,7 +149,9 @@ class ShopifySDK
149149 *
150150 * @var array
151151 */
152- public static $ config = array ();
152+ public static $ config = array (
153+ 'ApiVersion ' => '2019-04 '
154+ );
153155
154156 /**
155157 * List of available resources which can be called from this client
@@ -225,8 +227,7 @@ class ShopifySDK
225227 public function __construct ($ config = array ())
226228 {
227229 if (!empty ($ config )) {
228- ShopifySDK::$ config = $ config ;
229- ShopifySDK::setAdminUrl ();
230+ ShopifySDK::config ($ config );
230231 }
231232 }
232233
@@ -315,13 +316,14 @@ public static function setAdminUrl()
315316
316317 //Remove https:// and trailing slash (if provided)
317318 $ shopUrl = preg_replace ('#^https?://|/$# ' , '' , $ shopUrl );
319+ $ apiVersion = self ::$ config ['ApiVersion ' ];
318320
319321 if (isset (self ::$ config ['ApiKey ' ]) && isset (self ::$ config ['Password ' ])) {
320322 $ apiKey = self ::$ config ['ApiKey ' ];
321323 $ apiPassword = self ::$ config ['Password ' ];
322- $ adminUrl = "https:// $ apiKey: $ apiPassword@ $ shopUrl/admin/ " ;
324+ $ adminUrl = "https:// $ apiKey: $ apiPassword@ $ shopUrl/admin/api/ $ apiVersion / " ;
323325 } else {
324- $ adminUrl = "https:// $ shopUrl/admin/ " ;
326+ $ adminUrl = "https:// $ shopUrl/admin/api/ $ apiVersion / " ;
325327 }
326328
327329 self ::$ config ['AdminUrl ' ] = $ adminUrl ;
0 commit comments