# Shopify & WooCommerce Price & Stock Monitor (`kayorama/shopify-woo-price-stock-monitor`) Actor

Monitor Shopify and WooCommerce store prices and stock. Baseline or diff mode with change events, named KVS baselines, and optional webhooks. PPE-ready (store-scanned, change-detected).

- **URL**: https://apify.com/kayorama/shopify-woo-price-stock-monitor.md
- **Developed by:** [Kayorama](https://apify.com/kayorama) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 store scanneds

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Shopify & WooCommerce Price & Stock Monitor

Monitor **Shopify** and **WooCommerce** storefronts for price and stock changes. Run on a schedule in **baseline** mode (full snapshot) or **diff** mode (emit only changes). Baselines persist in a named Key-Value Store record per store.

### Features

- **Shopify first** via public `/products.json` pagination (up to 250 products per page)
- **WooCommerce** HTML path is structured but stubbed (theme selectors vary; extend as needed)
- **Diff events**: price % change, OOS ↔ in-stock, new SKUs, removed SKUs
- **store-scanned** summary for every store every run
- Optional **webhook** POSTs for change and summary events
- **Rate limiting** between requests; **clean fail on HTTP 403** (no auth bypass)
- **PPE-minded** events: `store-scanned`, `change-detected` (wired via `Actor.charge` when the run is pay-per-event)

### Input

| Field | Type | Description |
| --- | --- | --- |
| `storeUrls` | string\[] | Store homepage URLs (required) |
| `platforms` | `shopify` / `woo` / `auto`\[] | Platforms to try (default: `auto`) |
| `scheduleMode` | `baseline` | `diff` | Full snapshot vs changes only |
| `webhookUrl` | string | Optional webhook endpoint |
| `maxProducts` | integer | Cap per store (default 500) |
| `requestDelayMs` | integer | Delay between requests (default 500) |
| `proxyConfiguration` | object | Optional Apify Proxy |

#### Example

```json
{
  "storeUrls": ["https://www.allbirds.com"],
  "platforms": ["shopify"],
  "scheduleMode": "baseline",
  "maxProducts": 50
}
```

### Output

Dataset records:

- `type: "store-scanned"` — product count, change count, platform
- `type: "change-detected"` — `changeType` one of `price_change`, `stock_oos`, `stock_is`, `sku_new`, `sku_removed`
- `type: "store-error"` — clean errors (including 403)

Key-Value Store:

- `baseline-<host>` — last product snapshot for that store

### Pay-per-event (PPE)

Recommended event names for Console monetization:

| Event | When |
| --- | --- |
| `store-scanned` | Once per successfully scanned store |
| `change-detected` | Once per emitted change (diff mode) |

Configure pricing in Apify Console after push. Locally, charges are skipped or logged to the charging-log dataset when `ACTOR_TEST_PAY_PER_EVENT=true`.

### Rate limits & ethics

- Default 500 ms delay between requests
- Respect robots.txt and store Terms of Service
- On **403 Forbidden**, the Actor records a `store-error` and continues other stores — it does **not** attempt auth bypass or captcha solving

### How to run

```bash
apify run
```

Put input in `storage/key_value_stores/default/INPUT.json`.

### Changelog

- **0.1** — Initial release: Shopify products.json, Woo stub, baseline/diff, webhooks, PPE hooks

# Actor input Schema

## `storeUrls` (type: `array`):

List of store homepage URLs to monitor. Shopify: /products.json. WooCommerce: Store API, shop HTML, then product-sitemap.

## `platforms` (type: `array`):

Which platforms to try. Use "auto" to detect Shopify first, then WooCommerce.

## `scheduleMode` (type: `string`):

baseline: snapshot all products into named KVS keys and emit store-scanned. diff: compare against the last baseline and emit only changes (price %, OOS↔IS, new/removed SKUs) plus a store-scanned summary.

## `webhookUrl` (type: `string`):

If set, POSTs a JSON payload for each change-detected event and the final store-scanned summary.

## `maxProducts` (type: `integer`):

Cap products fetched per store (Shopify paginates at 250/page).

## `requestDelayMs` (type: `integer`):

Rate-limit delay between HTTP requests to the same store.

## `proxyConfiguration` (type: `object`):

Optional Apify Proxy. Leave empty for direct requests. Do not use proxies to bypass auth or site blocks you are not entitled to scrape.

## Actor input object example

```json
{
  "storeUrls": [
    "https://www.allbirds.com"
  ],
  "platforms": [
    "auto"
  ],
  "scheduleMode": "baseline",
  "maxProducts": 500,
  "requestDelayMs": 500,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Change events and store-scanned summaries.

## `baselines` (type: `string`):

Per-store product snapshots under keys baseline-<host>.

# 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 = {
    "storeUrls": [
        "https://www.allbirds.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kayorama/shopify-woo-price-stock-monitor").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 = { "storeUrls": ["https://www.allbirds.com"] }

# Run the Actor and wait for it to finish
run = client.actor("kayorama/shopify-woo-price-stock-monitor").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 '{
  "storeUrls": [
    "https://www.allbirds.com"
  ]
}' |
apify call kayorama/shopify-woo-price-stock-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kayorama/shopify-woo-price-stock-monitor"
        }
    }
}
```

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/L1yOe33pxMYvk2WNZ/builds/LPaRAAO2oZNUr9br7/openapi.json
