Monitor supplier product pages with PriceFetch, detect price changes, automatically update your storefront prices to maintain your target margin.
Dropshipping has a unique pricing challenge: your cost basis changes without notice. When your supplier raises a product's price from $20 to $25 and your store still lists it at $29.99, your margin just went from 33% to 17%. If the price goes above your listing price, you're selling at a loss.
Manual price checking doesn't scale. A store with 200 products across 3 suppliers means checking 600 URLs regularly. Miss one and you might fulfill orders at negative margin.
The solution is automated supplier price monitoring. PriceFetch checks your supplier URLs on a schedule and feeds the current prices into your repricing logic. Your storefront prices stay in sync with your actual costs.
The architecture for dropshipping price sync is straightforward:
1. **Product mapping table** — maps your store SKU to the supplier product URL, your current listing price, and your target margin percentage.
2. **Price checker** — a scheduled job that fetches current supplier prices from PriceFetch. Run this 2-4 times per day.
3. **Margin calculator** — compares the supplier price against your listing price. If your margin drops below the threshold, calculate a new listing price.
4. **Storefront updater** — pushes the new price to your store via its API (Shopify, WooCommerce, etc.).
5. **Out-of-stock handler** — if the supplier product is out of stock, mark it as unavailable on your store immediately. Nothing kills customer trust faster than accepting an order you can't fulfill.
import requests
API_KEY = "pf_live_abc123"
TARGET_MARGIN = 0.30 # 30% target margin
MIN_MARGIN = 0.15 # 15% minimum — below this, pause the listing
def sync_prices(products: list[dict]):
for product in products:
# Fetch supplier price
resp = requests.get(
"https://api.pricefetch.dev/v1/price",
params={"url": product["supplier_url"]},
headers={"X-API-Key": API_KEY},
timeout=30,
)
data = resp.json()
if not data["success"]:
continue
supplier_price = data["data"]["price"]
in_stock = data["data"]["in_stock"]
# Handle out-of-stock
if not in_stock:
pause_listing(product["store_sku"])
continue
# Calculate required listing price
ideal_price = round(supplier_price / (1 - TARGET_MARGIN), 2)
current_price = product["listing_price"]
# Check if margin is still healthy
current_margin = (current_price - supplier_price) / current_price
if current_margin < MIN_MARGIN:
# Margin too thin — raise price
update_store_price(product["store_sku"], ideal_price)
alert(f"{product['name']}: supplier raised to ${supplier_price}, "
f"updated listing to ${ideal_price}")
elif abs(ideal_price - current_price) > 2.00:
# Supplier price dropped significantly — you could lower price
# to be more competitive, or keep the extra margin
update_store_price(product["store_sku"], ideal_price)Dropshipping price sync has several edge cases that trip up naive implementations:
**Supplier out of stock** — pause the listing immediately. Don't wait for the next sync cycle. If you detect out-of-stock, your storefront API call should happen in seconds, not hours.
**Price spikes** — sometimes supplier prices spike temporarily due to demand or inventory issues. Before auto-raising your price by 50%, implement a confirmation check: if the price increase exceeds 20%, wait one cycle and re-check before applying.
**Currency mismatches** — if your store is in USD but your supplier lists in GBP, you need a currency conversion layer. PriceFetch returns the currency alongside the price. Use a forex API or daily rates to convert.
**Multiple suppliers for one product** — some dropshippers have backup suppliers. Check all of them and use the cheapest in-stock option as your cost basis.
**Shipping cost changes** — PriceFetch returns the product price, not the total with shipping. If your supplier charges separate shipping, factor that into your margin calculation.
Most dropshipping stores run on Shopify or WooCommerce. Here's how the price sync connects:
**Shopify** — use the Shopify Admin REST API to update product variants. The endpoint is `PUT /admin/api/2024-01/variants/{variant_id}.json` with the new price in the body. Shopify rate limits to 2 requests/second with the REST API.
**WooCommerce** — use the WooCommerce REST API. `PUT /wp-json/wc/v3/products/{id}` with `regular_price` in the body. WooCommerce on shared hosting can be slow — batch updates when possible.
**For both platforms**, maintain a mapping between your internal product IDs, the supplier URLs, and the platform-specific product/variant IDs. This three-way mapping is the core data structure for your sync system.
Log every price update with the old price, new price, supplier price, and calculated margin. This audit trail is essential for debugging margin issues and understanding your pricing history.
Sign up in 30 seconds. No credit card required. One credit per successful API call.