PHP code example of robby-bugatti / shopify-php-sdk
1. Go to this page and download the library: Download robby-bugatti/shopify-php-sdk 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/ */
$service = new Shopify\Service\ProductService($client);
$service->all(); #Fetch all products, with optional params
$service->get($productId); # Get a single product
$service->count(); # Count the resources
$service = new Shopify\Service\ProductService($client);
$product = new Shopify\Object\Product();
# Set some product fields
$product->title = 'Test Product';
$product->vendor = 'Printer';
$service->create($product);
$service = new Shopify\Service\ProductService($client);
$product = $service->get($productId);
# Set some product fields
$product->title = 'Test Product';
$product->vendor = 'Printer';
$service->update($product);
$service = new Shopify\Service\ProductService($client);
$service->delete($productId);