Giter VIP home page Giter VIP logo

shopify_php_api's Introduction

DEPRECATION

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.

AUTHOR

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

DESCRIPTION

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.

DOCUMENTATION

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

INSTALL

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 http://www.shopify.com/partners/

TESTING

You can test the API by going to http://www.yourdomain.com/shopify_php_api/test/shopify_api_test.php If you would like to test your application you can create tests using the SimpleTest library that is provided.

BASIC USAGE

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

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

This will send the owner of 'mystore.myshopify.com' (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');
$api->product->create($fields);

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);

REPORTING BUGS

Email william [at] shopify [dot] com

FREQUENTLY ASKED QUESTIONS

http://wiki.shopify.com/PHP_API_FAQ

COPYRIGHT

jadedPixel / Shopify

shopify_php_api's People

Contributors

dylanahsmith avatar yevgenko avatar daniellmb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.