Skip to content

Services ​

Key service classes in the companion app.

ShopifyClient ​

App\Services\ShopifyClient

The central service for communicating with Shopify's Admin API. Supports both GraphQL and REST.

GraphQL ​

php
$client = app(ShopifyClient::class);

$response = $client->graphql('
    query {
        products(first: 10) {
            edges {
                node {
                    id
                    title
                }
            }
        }
    }
');

GraphQL requests include automatic throttle detection and retry — when Shopify returns a throttled response, the client waits and retries.

REST ​

php
$response = $client->rest('GET', '/admin/api/2025-04/products.json');

Authentication ​

Authentication is handled by ShopifyTokenManager, which:

  1. Uses the client credentials grant to exchange the client ID and secret for an access token
  2. Caches the encrypted token in Redis
  3. Auto-refreshes when the token expires (typically every 24 hours)

ShopifyInventoryService ​

App\Services\ShopifyInventoryService

Cache-aside inventory service that:

  • Checks Redis for cached stock data
  • On miss, queries the Admin API for inventory levels per location
  • Caches the result with a configurable TTL
  • Invalidates cache when inventory webhooks arrive

BundleService ​

App\Services\BundleService

Handles bundle resolution and cart operations:

  • Finding bundles for a product or set of products
  • Resolving slot products and available variants
  • Processing add-to-cart requests for bundles

BundlePricingService ​

App\Services\BundlePricingService

Calculates bundle prices based on the configured pricing type:

  • Percentage — applies a percentage discount to the bundle total
  • Fixed Amount — subtracts a fixed amount from the bundle total
  • Fixed Total — the bundle sells at a specific price regardless of item prices

BundleDiscountService ​

App\Services\BundleDiscountService

Manages Shopify discounts for bundles via the Admin API (GraphQL):

  • Creates automatic discounts (preferred) or falls back to discount codes
  • Monitors discount health and status
  • Cleans up orphaned or expired discounts

ShopifyShippingService ​

App\Services\ShopifyShippingService

Fetches shipping profile data from Shopify to determine free shipping thresholds.

ShopifyCustomerService ​

App\Services\ShopifyCustomerService

Customer-related Shopify API operations.

NominatimGeocodingService ​

App\Services\NominatimGeocodingService

Geocodes store addresses using the Nominatim API (OpenStreetMap). Used by the GeocodeStore job when stores are created or updated in Filament.

Klaviyo Integration ​

App\Integrations\Klaviyo\

Optional Klaviyo integration that syncs wishlist and OOS events:

  • KlaviyoClient — API client for Klaviyo
  • Event listeners for wishlist and OOS events
  • Jobs for async Klaviyo sync

Internal developer documentation