Laravel Shopify
  • 🛍️Laravel Shopify
  • Getting Started
    • 👋Installation
  • Usage
    • Prerequisites
    • Intializing the client
    • Making Requests
      • Pagination
      • GraphQL
    • Custom Requests
    • Custom Error Handling
    • Available Methods
      • Supported Method
    • Webhooks
Powered by GitBook
On this page
  1. Usage

Making Requests

Once a client has been initialized, you may make requests to Shopify using the available methods.

Let's take a look at a couple of examples:

$shopify = \Pactode\Shopify\Factory::fromConfig();

// Paginate products
$cursor = $shopify->paginateProducts(); // returns a Cursor

// Get products count
$count = $shopify->getProductsCount(); // returns an integer

// Get products
$products = $shopify->getProducts(); // returns a Collection of ProductResource

// Create a product
$product = $shopify->createProduct([
    'title' => 'Adidas Shoe, Pink',
]); // returns a ProductResource

// Get a specific product
$product = $shopify->getProduct($productId); // returns a ProductResource

// Update a product
$product = $shopify->updateProduct($productId, [
    'title' => 'Adidas Shoe, Rose',
]); // returns a ProductResource 

// Deleting a product
$shopify->deleteProduct($productId);

PreviousIntializing the clientNextPagination

Last updated 1 year ago

Please refer to the to check which attributes are required for each request. The resource key in the payload will be populated to your payload automatically based on the method, i.e. "product" for the createProduct method.

official documentation