Why Did Staging Charge Real WooCommerce Renewals?

Why This Happens

Cloning a WordPress site for staging typically copies the entire database, including live payment gateway API keys, stored customer payment tokens, and every pending Action Scheduler entry for subscription renewals. Nothing about a database clone inherently marks it as "not the real site" — if WP-Cron or a server cron job is active on that staging copy and a renewal happens to be due, it fires exactly as it would in production, using the real gateway credentials it inherited.

This has caught out experienced WooCommerce developers, not just beginners — it's a structural risk in how staging environments are typically created, not a sign of doing something obviously wrong.

Common Causes

  • A full database clone without disabling cron on the staging copy before or immediately after the clone completes.
  • Staging hosting plans that enable WP-Cron by default with no obvious warning that live payment credentials came along with the database.
  • Payment gateway plugins storing live API keys in the database rather than in an environment-specific config file that wouldn't transfer with a simple clone.
  • A staging site left running long-term rather than torn down promptly, increasing the window in which a scheduled renewal could fall due.

How to Prevent It

  1. Disable WP-Cron immediately after cloning to staging, before doing anything else — add define('DISABLE_WP_CRON', true); to the staging site's wp-config.php as the very first step.
  2. Switch payment gateways to test/sandbox mode on the staging copy, using sandbox API keys rather than the live account's credentials, so even an accidental charge attempt can't touch real money.
  3. Use a staging tool that automatically handles this — many managed WordPress hosts' staging features switch gateways to test mode or disable cron by default specifically because of this risk; confirm your host's actually does before relying on it.
  4. If a staging site already ran with cron active, check WooCommerce → Status → Scheduled Actions on it immediately and check the live site's actual order/subscription records for any charges that shouldn't exist.
  5. If a real customer was charged from a staging environment, that needs an immediate refund and, if there's a pattern of the same failure recurring, a proper audit of how staging environments get created going forward.

If this has already happened and needs auditing or a hardened staging workflow going forward, see WooCommerce fixes.

Available for new projects

NEXT STEP

Rather have it fixed than keep reading?

Based in Dhaka, Bangladesh — serving clients worldwide. Tell me what's happening and you'll have a reply within one working day.

  • Reply within one working day
  • Fixed quote before work starts
  • UK, EU and US hours covered