Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Shopify PHP API
branch: master


This library is currently deprecated due to lack of maintenance, and because there are now great alternatives available. Alternative Shopify PHP libraries can be found on the PHP section of the Shopify APP Development page on the Shopify Wiki.


William Lang (william [at] shopify [dot] com)


The PHP library will allow developers who are more comfortable with PHP to create Shopify apps.

It has all the bells and whistles of its Ruby counterpart to help you create great applications for release in the Shopify App Store.


You can look at documentation by opening index.html in the docs directory.


Upload the shopify_php_api to your webserver. Modify lib/shopify_api_config.php with your application's API Key and Secret found in your partner account at


You can test the API by going to If you would like to test your application you can create tests using the SimpleTest library that is provided.


Authentication is easy to do. The API will generate all the necessary URLs your application needs to authenticate.

$api = new Session('', '', 'YOUR_API_KEY', 'YOUR_SECRET');
header("Location: " . $api->create_permission_url());

This will send the owner of '' (usually you would prompt for this information) to the permission URL needed for authentication and installation of your app. The Shopify platform will then automatically redirect the user to your application's return URL with their shop, token and signature.

$shop = $_GET['url'];
$token = $_GET['t'];
$api = new Session($shop, $token, 'YOUR_API_KEY', 'YOUR_SECRET');

Now that your user has given your application permission to read and/or write, we can ask for the products in their store:

$storeProducts = $api->product->get();

foreach ($storeProducts as $product){
      echo $product['title'].'<br />';

This prints all products in the authenticated user's shop. You can also get a specific product by passing its product id to the product get() method.

$aProduct = $api->product->get(1234567);
echo $aProduct['title'];

To create a new product (if your application has write permissions), you can use the product create() method by passing fields you would like your new product to have.

$fields = array('title' => 'My New Product');

To update a product (if your application has write permissions), you can use the product modify() method by passing the product id and the fields you would like to modify.

$fields = array('title' => 'My Updated Title');
$api->product->modify(1234567, $fields);


Email william [at] shopify [dot] com



jadedPixel / Shopify

Something went wrong with that request. Please try again.