1. Go to this page and download the library: Download vladimircatrici/shopify-api 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/ */
$api->delete('products/123456789');
if ($api->respCode == 200) {
// Item has been successfully removed
}
use VladimirCatrici\Shopify\ClientManager;
$api = ClientManager::get('default');
$products = new Collection($api, 'products');
foreach ($products as $product) {
printf('#%d. %s [$%f],
$product['id'], $product['title'], $product['price']
);
}
use VladimirCatrici\Shopify;
if (Shopify\Webhook::validate('your-webhook-token')) {
printf('`%s` webhook triggered on your store (%s). Data received: %s',
Shopify\Webhook::getTopic(),
Shopify\Webhook::getShopDomain(),
Shopify\Webhook::getData()
);
} else {
// Invalid request | Unauthorized webhook | Data corrupted
}
// You can also get webhook data as array right away
$data = Shopify\Webhook::getDataAsArray();
printf('Product ID#%d, product title: %s',
$data['id'], $data['title']
);