# Shopify Price & Stock Monitor with Margin Checks (`sauliusautomatesit/shopify-price-margin-monitor`) Actor

Monitor exact Shopify product variants for price changes and restocks. Compare against your own price and costs, flag margin risks, and export a repeatable watchlist. Platform usage included.

- **URL**: https://apify.com/sauliusautomatesit/shopify-price-margin-monitor.md
- **Developed by:** [Saulius Saulenas](https://apify.com/sauliusautomatesit) (community)
- **Categories:** E-commerce, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.25 / 1,000 completed product checks

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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 Price & Stock Monitor with Margin Checks

Check the exact Shopify products you care about. Export prices and availability, spot changes since your previous run, and see whether matching a competitor would meet your chosen margin.

**Quick start:** paste a public product URL in the watchlist and run. Open the Products dataset. Save SNAPSHOT and supply it as previousSnapshot on the next run.

### Who this is for

Retailers and agencies building price-watch spreadsheets or their own pricing workflows. You choose comparable products and variants, including products organised as separate flavour/size pages. The Actor provides evidence and calculations; it does not change prices or access Shopify Admin.

### Example

```json
{"watchlist":[{"productUrl":"https://www.beardbrand.com/products/fox-hunt-mens-cologne","variantId":"62111906529650","referenceCurrency":"USD","referencePrice":55,"unitCost":35,"minMarginPercent":25}],"previousSnapshot":[],"onlyChanges":false}
```

The price and cost in that example are illustrative inputs, not the store's costs. Leave them out for ordinary monitoring. A comparison requires an exact variantId and referenceCurrency. Without variantId, the check returns the product's available API sample, up to 250 variants. A variant in the URL query is recognised. You may provide locale paths such as /en-gb/products/example.

### What you get

- One dataset row per observed variant: title, SKU, barcode, displayed price, currency, availability, source URL and observation time.
- Change labels: BASELINE, PRICE\_DOWN, PRICE\_UP, BACK\_IN\_STOCK, OUT\_OF\_STOCK or CURRENCY\_CHANGED.
- Optional comparison: price gap, minimum price for your chosen margin, and margin at the competitor's displayed price.
- PRICE-REPORT: changes, margin warnings, currency mismatches and coverage.
- SNAPSHOT: portable state for your next check. SUMMARY records failed checks and spending limits.

The margin floor is `unitCost / (1 - minMarginPercent / 100)`, rounded up to the next cent. Include all costs you need in unitCost and use a consistent tax basis. Shipping, discounts, subscriptions, fees and product equivalence are not verified. A price mismatch across currencies disables the comparison. Availability is the public storefront flag; it is not an inventory quantity or a guarantee of checkout availability.

### Pricing

**$0.005 per completed product check** before plan discounts. One watchlist entry is one check, including unchanged checks and all returned variants for that entry. Ten checks cost $0.05005 at the base tier, including one start event. Failed or malformed checks have no product-check charge. Setting onlyChanges does not make the check free. Compute, proxy and storage usage during the run are included.

Product-check prices: FREE $0.005, Bronze $0.00475, Silver $0.0045, Gold/Platinum/Diamond $0.00425. Actor start (`apify-actor-start`) is **$0.00005**, once per allocated GB, minimum one. Default memory is 256 MB, so one start event. Set a maximum run cost to control spending. Ordinary downloads and storage outside the run may incur Apify usage.

### Coverage and repeat runs

The tool reads the public Shopify Ajax product API and cart currency endpoint without login or account cookies. Stores that block or disable those endpoints fail explicitly. Missing products, failed requests and missing variants are not labelled out of stock. Source APIs expose up to 250 variants; a missing variant may lie outside that sample. No product-removal inference is made.

Supported currencies: USD, EUR, GBP, CAD, AUD, NZD, CHF, SGD, HKD, SEK, NOK, DKK, PLN, CZK, HUF, RON, BGN, TRY, BRL, MXN, ZAR and INR. Other currencies fail explicitly. Prices reflect the returned storefront market, not every country's offer.

Pass SNAPSHOT only after SUMMARY.partial is false. Retain the previous complete snapshot after an incomplete run. Baselines belong to your workflow, so concurrent runs do not overwrite shared history. The first run is a baseline, not evidence of a new product or recent price change. A run where every attempted check fails is marked FAILED.

Use Apify's API/MCP tabs to integrate, or schedule your saved input through Apify. Repeat-run setup is available in the downloadable workflow linked below. No alerts are emailed and no store prices are changed by this Actor.

### Download the repeat-run workflow

[Download the Python workflow and example watchlists (ZIP)](https://api.apify.com/v2/key-value-stores/NC097H6r9b5xqENAU/records/business-monitor-workflows-v1.zip?signature=YrU8NLIqwCcHeRTnacwH). Requires Python 3.10 or newer and your APIFY\_TOKEN. No additional Python packages are needed.

The workflow runs a watchlist, exports CSV and JSON, and saves the next baseline only after a complete run. It includes a per-run spending cap and a resume command for interrupted downloads. See the included README for setup. Schedule the command with your existing scheduler if you want recurring checks.

# Actor input Schema

## `watchlist` (type: `array`):

1–50 objects with productUrl. Optional variantId selects an exact variant. For comparisons also provide referenceCurrency, referencePrice and/or unitCost; minMarginPercent defaults to 20.

## `previousSnapshot` (type: `array`):

Paste SNAPSHOT from your last complete run to detect price and availability changes.

## `onlyChanges` (type: `boolean`):

The first observation establishes a baseline. Completed unchanged checks are still charged.

## Actor input object example

```json
{
  "watchlist": [
    {
      "productUrl": "https://www.beardbrand.com/products/fox-hunt-mens-cologne"
    }
  ],
  "previousSnapshot": [],
  "onlyChanges": false
}
```

# Actor output Schema

## `products` (type: `string`):

No description

## `report` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `snapshot` (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 = {
    "watchlist": [
        {
            "productUrl": "https://www.beardbrand.com/products/fox-hunt-mens-cologne"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sauliusautomatesit/shopify-price-margin-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 = { "watchlist": [{ "productUrl": "https://www.beardbrand.com/products/fox-hunt-mens-cologne" }] }

# Run the Actor and wait for it to finish
run = client.actor("sauliusautomatesit/shopify-price-margin-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 '{
  "watchlist": [
    {
      "productUrl": "https://www.beardbrand.com/products/fox-hunt-mens-cologne"
    }
  ]
}' |
apify call sauliusautomatesit/shopify-price-margin-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sauliusautomatesit/shopify-price-margin-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/War6vH1uKk7xe6xXH/builds/XI8EA3GAD9kI0WAju/openapi.json
