Custom Webhooksinventorye-commerceShopify

How to Stop Advertising Out-of-Stock Products Automatically

Shopify Store — Inventory-Based Ads7 min read

Stop Advertising Products You Cannot Sell

Every e-commerce business has experienced it: a product sells faster than expected, stock dwindles to single digits, yet paid ads keep driving traffic to the product page. Customers click, land on an out-of-stock notice, and leave frustrated. The business pays for the click, loses the potential customer, and damages brand trust in one swift motion. Multiply that across dozens or hundreds of SKUs and the wasted ad spend becomes a serious drag on profitability.

The root problem is a disconnect between your inventory management system and your advertising platforms. Stock levels change by the minute, but campaign managers typically review and update ads once or twice a day at best. That gap is where money leaks. Inventory-based advertising automation closes it by letting your stock data drive your campaigns on a schedule you set — as often as every hour — pausing ads once a product drops below a safe threshold and re-enabling them once replenishment arrives.

Why This Approach Works

Traditional campaign management treats advertising and fulfilment as separate concerns. A media buyer sets budgets and targeting, while the warehouse team manages stock. The only link between the two is a manual check, a spreadsheet export, or a delayed feed update. Inventory-based ad automation removes the human bottleneck entirely.

When your inventory platform pushes stock-level data to AdTrigger via webhook, your rules are checked against the latest values on the interval you choose — as often as hourly. If a SKU is below your defined threshold at that check, the corresponding campaign is paused. When stock is replenished and the count exceeds your re-enable threshold, the campaign comes back online automatically at the next check. This means every pound or dollar of ad spend is directed at products you can actually fulfil.

The business logic is straightforward: do not pay for traffic you cannot convert. By aligning ad visibility with stock availability, you protect your return on ad spend, reduce customer frustration, and free your team from the tedious cycle of manually toggling campaigns.

How to Set This Up in AdTrigger

Setting up inventory-driven ad automation takes just a few minutes. Here is the step-by-step process:

Step 1: Create a Data Source

Log into AdTrigger and navigate to Data Sources. Click Create Data Source and give it a descriptive name such as "Shopify Inventory" or "WMS Stock Feed". Select Custom Webhook as the source type.

Step 2: Define Your Field Schema

Define the fields your webhook payload will contain. For inventory management, you will typically need:

  • product_sku (string) — the unique product identifier
  • stock_count (number) — current available inventory
  • status (string) — a status label such as "in_stock", "low_stock", or "out_of_stock"

Step 3: Get Your Webhook URL and API Key

Once the data source is created, AdTrigger generates a unique webhook URL and an API key. Copy both. The API key is used as a Bearer token in the Authorization header of every request, ensuring only your systems can push data to this endpoint.

Step 4: POST Data from Your Inventory System

Configure your inventory platform, warehouse management system, or a simple cron job to send an HTTP POST request to the webhook URL whenever stock levels change. Any system that can make an HTTP request can be the trigger — Shopify webhooks, WooCommerce hooks, a custom script polling your ERP, or even a Zapier automation.

Step 5: Build Your Rules

Navigate to Rules and create a new rule linked to your inventory data source. Set conditions using the numeric comparison operators:

  • Pause condition: stock_count is less than (lt) 10
  • Enable condition: stock_count is greater than (gt) 50

You can also combine conditions using AND logic. For example, pause only when stock_count < 10 AND status eq "low_stock" for extra safety. Assign the rule to the specific Google Ads or Meta Ads campaigns (or ad groups) that promote the relevant products.

Example Webhook Payload

Here is the JSON your inventory system would POST to the AdTrigger webhook endpoint:

POST https://api.adtrigger.io/webhooks/<your-source-id>
Authorization: Bearer <your-api-key>
Content-Type: application/json

{
  "product_sku": "UMBRELLA-001",
  "stock_count": 7,
  "status": "low_stock"
}

When AdTrigger receives this payload, it evaluates the stock_count value of 7 against your rule. Since 7 is less than 10, the associated campaign is paused. Later, when your warehouse processes a restock and sends a payload with stock_count: 120 and status: "in_stock", the campaign is automatically re-enabled.

Maximising Your Return on Ad Spend

Connecting inventory data to your ad campaigns unlocks several optimisation strategies beyond simple pause-and-enable logic:

  • Graduated budget scaling: Instead of a binary on/off, use budget adjustment actions. When stock is above 200 units, increase budget by 30%. When stock is between 50 and 200, run at baseline. When stock drops below 50, reduce budget by 50%. This keeps campaigns live for high-demand products while throttling spend proportionally.
  • Separate rules per product tier: High-margin products might warrant advertising down to the last 5 units, while low-margin items should pause at 20. Create different rules for different product categories.
  • Use TTL expiration as a safety net: AdTrigger's automatic data expiration means that if your inventory system stops sending updates, the stale data expires and your rules can account for that. This prevents campaigns from staying paused indefinitely if your webhook integration goes down.
  • Review the audit trail weekly: AdTrigger logs every action it takes. Review the audit trail to spot patterns — if certain products are constantly toggling, it may indicate a supply chain issue worth addressing upstream.
  • Align with seasonal demand: Adjust your stock thresholds before peak periods like Black Friday or holiday sales when you expect faster sell-through rates.

Common Pitfalls to Avoid

  • Setting pause and enable thresholds too close together: If you pause at stock below 10 and re-enable at stock above 11, a single sale could cause rapid toggling. Leave a meaningful gap between your thresholds — pause at 10, re-enable at 50 — to avoid campaign instability.
  • Forgetting to include the product identifier: If you manage multiple products, ensure your payload includes a field like product_sku so you can target rules at specific campaigns rather than pausing everything.
  • Not testing with a staging campaign first: Before connecting your live campaigns, test the webhook integration with a low-budget test campaign to confirm the payload format and rule logic work as expected.
  • Ignoring restock lead times: If it takes three days to restock a product, your pause threshold should account for how many units you sell in three days, not just a static number.
  • Overlooking budget adjustment caps: When using percentage-based budget adjustments, always set minimum and maximum caps to prevent budgets from scaling beyond sensible limits.

The Bottom Line

Inventory-based ad automation is one of the highest-impact optimisations an e-commerce business can make. Every click on an out-of-stock product is money wasted and a customer disappointed. By connecting your inventory system to AdTrigger via a simple webhook, you ensure that ad spend flows only to products you can actually sell. The setup takes minutes, the integration works with any platform that can make an HTTP POST request, and the result is a measurable improvement in ROAS and customer experience. Available on Starter, Professional, and Enterprise plans, this is the kind of automation that pays for itself within the first week.

Ready to automate this?

Set up this exact automation in AdTrigger — no code, no manual monitoring, just rules that act on real-time data.

Start Free