PHP code example of shopify / shopify-php

1. Go to this page and download the library: Download shopify/shopify-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shopify / shopify-php example snippets



Shopify\ShopifyClient;

$client = new ShopifyClient($access_token, "yourshop.myshopify.com");
$products = $client->products->readList();


$newOrder = ['line_items' => [['title' => 'cool', 'price' => 4]]];
$response = $client->orders->create($newOrder);

$response = $client->orders->read($orderId);
$object = $response->parsedResponse();

$orders = $client->orders->readList();
foreach ($order in $orders->parsedResponse()) {
    var_dump($order->id);
}

$response = $client->orders->update($orderId, ["note" => "cool order"]);

$response = $client->orders->readCount(["status" => "open"]);

$response = $client->orders->delete($orderId);