PHP code example of yvz / bigcommerce-api-service

1. Go to this page and download the library: Download yvz/bigcommerce-api-service 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/ */

    

yvz / bigcommerce-api-service example snippets


use Yvz\BigcommerceApiService\Services\BigcommerceApiService;

$service = new BigcommerceApiService('storeHash', 'accessToken');

// Example: Fetch product list
$products = $service->products->list(['limit' => 10]);

      $categories = $service->categories->list(['limit' => 10]);
      

      $category = $service->categories->show(123);
      

      $brands = $service->brands->list(['limit' => 5]);
      

      $brand = $service->brands->show(45);
      

      $products = $service->products->list(['limit' => 20]);
      

      $product = $service->products->show(567);
      

      $variants = $service->variants->list(1234, []);
      

      $batchVariants = $service->variants->batchList([]);
      

      $variant = $service->variants->show(1234, 5678);
      

      $modifiers = $service->modifiers->list(1234, []);
      

      $modifier = $service->modifiers->show(1234, 4321);
      

      $customFields = $service->customFields->list(1234, []);
      

      $customField = $service->customFields->show(1234, 5678);
      

      $metafields = $service->variantMetafields->list(1234, 5678, []);
      

[
    'status' => true,        // true if request was successful
    'statusCode' => 200,     // HTTP response code
    'data' => [...],         // Response data
    'headers' => [...]       // Headers in the response
]

[
    'status' => false,       
    'statusCode' => 400,     
    'error_bag' => 'Error message...', 
    'headers' => [...]
]