# Shopify Variant Cartability Checker (`silver-rook-labs/shopify-variant-cartability-checker`) Actor

Verify whether an exact Shopify variant and quantity can actually enter cart and reach checkout right now.

- **URL**: https://apify.com/silver-rook-labs/shopify-variant-cartability-checker.md
- **Developed by:** [Sean Kinahan](https://apify.com/silver-rook-labs) (community)
- **Categories:** E-commerce
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Shopify Variant Cartability Checker

Verify whether an exact Shopify product variant and quantity can actually enter cart and reach checkout right now.

Shopify catalog availability does not always reflect transactional reality. This Actor checks the exact variant against the live public storefront cart flow and returns a deterministic verdict.

The core `checkCartability()` function is independent of Apify; `src/main.ts` is only the Actor wrapper.

### Input

```json
{
  "productUrl": "https://store.example/products/example-product",
  "variantId": "1234567890",
  "quantity": 1,
  "expectedPrice": 49.99,
  "expectedCurrency": "USD"
}
```

`productUrl` and `variantId` are required. `quantity` defaults to `1`. Option-name resolution is not supported in v0; pass the exact Shopify variant ID.

Batch input is also supported. The Actor emits one dataset row per check:

```json
{
  "checks": [
    {
      "productUrl": "https://store.example/products/example-product",
      "variantId": "1234567890",
      "quantity": 1
    },
    {
      "productUrl": "https://store.example/products/example-product",
      "variantId": "9876543210",
      "quantity": 2,
      "expectedPrice": 39.99,
      "expectedCurrency": "USD"
    }
  ]
}
```

Single-check input remains supported for backward compatibility. Batch runs accept up to 50 checks. If one batch item has invalid input, that item returns an `input_error` row and the remaining checks continue.

### Output

```json
{
  "status": "cartable",
  "productUrl": "https://store.example/products/example-product",
  "storeOrigin": "https://store.example",
  "variantId": "1234567890",
  "variantFound": true,
  "declaredAvailable": false,
  "requestedQuantity": 1,
  "acceptedQuantity": 1,
  "observedPrice": 49.99,
  "observedPriceMinor": 4999,
  "currency": "USD",
  "addToCartAccepted": true,
  "cartLineMatched": true,
  "checkoutReachable": true,
  "expectedPrice": 49.99,
  "expectedCurrency": "USD",
  "priceMatchesExpected": true,
  "checkedAt": "2026-08-15T16:00:00.000Z"
}
```

`declaredAvailable` is catalog metadata. `status` is based on the observed transactional flow. They may legitimately disagree.

### Statuses

| Status | Meaning |
| --- | --- |
| `cartable` | Exact variant exists, requested quantity appears in cart, exact cart line matches, and checkout is reachable. |
| `variant_not_found` | Product metadata was accessible, but the supplied variant was absent. |
| `unavailable` | Transactional evidence shows quantity 1 cannot be placed into cart because of availability. |
| `quantity_rejected` | Exact variant exists, but the cart accepts fewer than requested. |
| `cart_rejected` | The cart mutation gives a definitive rejection. |
| `checkout_unreachable` | The exact line enters cart, but checkout cannot be reached through ordinary public behavior. |
| `unsupported_storefront` | The supplied page does not expose the standard Shopify flow this Actor supports. |
| `inconclusive` | Network, protection, or response behavior is ambiguous. |
| `input_error` | Batch item input is invalid. Other batch items still run. |

Price mismatch is not a terminal state. If `expectedPrice` or `expectedCurrency` differs from the observed result, the Actor reports the transactional status and sets `priceMatchesExpected` to `false` with a reason code where available.

### Boundaries

This Actor only checks public storefront behavior. It does not authenticate, bypass CAPTCHA, enter customer information, enter shipping information, submit payment, reserve inventory intentionally, or place orders.

### Commands

```bash
npm test
npm run build
npm start
```

# Actor input Schema

## `productUrl` (type: `string`):

Public Shopify product page URL for the product that contains the exact variant.

## `variantId` (type: `string`):

Exact Shopify variant ID to verify. Option-name resolution is not supported in v0.

## `quantity` (type: `integer`):

Quantity to verify. Defaults to 1.

## `expectedPrice` (type: `number`):

Optional expected decimal price, such as 49.99. A mismatch does not override cartability.

## `expectedCurrency` (type: `string`):

Optional ISO currency code expected by the caller, such as USD.

## `checks` (type: `array`):

Optional batch of cartability checks. When provided, each item is checked and emitted as a separate dataset row.

## Actor input object example

```json
{
  "productUrl": "https://www.puravidabracelets.com/products/for-the-troops-original",
  "variantId": "33173626585174",
  "quantity": 1,
  "expectedPrice": 8,
  "expectedCurrency": "USD"
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `run` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "productUrl": "https://www.puravidabracelets.com/products/for-the-troops-original",
    "variantId": "33173626585174",
    "expectedPrice": 8,
    "expectedCurrency": "USD"
};

// Run the Actor and wait for it to finish
const run = await client.actor("silver-rook-labs/shopify-variant-cartability-checker").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "productUrl": "https://www.puravidabracelets.com/products/for-the-troops-original",
    "variantId": "33173626585174",
    "expectedPrice": 8,
    "expectedCurrency": "USD",
}

# Run the Actor and wait for it to finish
run = client.actor("silver-rook-labs/shopify-variant-cartability-checker").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "productUrl": "https://www.puravidabracelets.com/products/for-the-troops-original",
  "variantId": "33173626585174",
  "expectedPrice": 8,
  "expectedCurrency": "USD"
}' |
apify call silver-rook-labs/shopify-variant-cartability-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,silver-rook-labs/shopify-variant-cartability-checker"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/DonTKpdkW25WUpvnK/builds/U2eCMan1lEdAUCUZ2/openapi.json
