AgeOnce Docs
WordPress

WooCommerce Integration

Checkout protection for age-restricted products

WooCommerce Integration

When WooCommerce is installed, the AgeOnce plugin automatically protects checkout for products that require age verification.

New stores can test this flow on the AgeOnce free plan. No credit card is required for the free tier.

How it works

  1. You mark products that require verification (see below)
  2. When such a product is in the cart, the checkout page shows the verification gate
  3. User must complete AgeOnce verification before placing the order
  4. After successful verification, the order can be completed
  5. The order stores verification status, Transaction ID, and verification time

Marking products for verification

Method 1: Per-product checkbox

The checkbox is read only when Products are enabled in Content Rules and Allow Manual Locking via Metabox is on for Products. A checked product requires 18+. Use a product category when the threshold must be 16+ or 21+.

  1. Go to AgeOnce → Content Rules, enable Products, and turn on Allow Manual Locking via Metabox
  2. Edit the product in WooCommerce
  3. In Product Data → General, find Age Verification Required
  4. Check the box
  5. Save

Method 2: Product categories (Content Rules)

  1. Go to AgeOnce → Content Rules
  2. Enable Products
  3. Select Active Age Groups (e.g. 18+)
  4. In 18+ Rules, select Product Categories (e.g. Alcohol, Tobacco)
  5. All products in those categories will require verification

Method 3: Both

Products can be restricted by category and/or individually. The highest required age applies.

Checkout behavior

Before verification

When the cart contains age-restricted products:

  • Verification gate appears above the Place Order button
  • "Verify Age" button redirects to AgeOnce
  • Checkout is blocked until verification is completed

After verification

  • Success message: "Age Verified. You can proceed."
  • User can place the order
  • Guests keep the result in the WooCommerce session and a cookie for 24 hours
  • A logged-in customer also keeps it on their WordPress account. A later visit does not require another check for that age, or a lower one. An 18+ result does not satisfy a 21+ product.

Customer signup

Off by default. In AgeOnce settings, open WooCommerce customer signup to require verification before a guest can create a store account on My Account. Choose 16+, 18+, or 21+. Details are in Plugin Settings.

Callback URL

The plugin uses this Redirect URI for checkout verification:

https://yoursite.com/?ageonce_callback=1

Add it to Dashboard Settings → Redirect URIs. The plugin shows the exact URL to copy in AgeOnce → Settings.

Transaction ID and audit

After a successful verification at checkout, the plugin saves the Transaction ID (Audit ID) to the order as order meta. In the WordPress admin:

  • Open the order and check the AgeOnce metabox in the sidebar
  • You will see Tx ID and Verified At for verified orders

You can store this Transaction ID (e.g. in your order or CRM) and later look up the verification in the Dashboard Audit Logs: search by this ID to see when and how the verification was completed. This helps with compliance and support.

  1. Create a test product category such as Alcohol or 21+
  2. Assign one test product to that category
  3. Enable Products in AgeOnce → Content Rules
  4. Select the test category under the right age threshold
  5. Open checkout in an incognito browser window
  6. Complete AgeOnce verification and confirm the order stores the verification metadata

To run your own code after verification, or to assign a custom role only after a verification product is paid, see Developer hooks.

Compatibility

Tested with WooCommerce 5.0+ and common themes (Storefront, Astra, etc.). If you use custom checkout or checkout-modifying plugins, test on a staging site first.

On this page