Skip to content

WooCommerce Testing Guide

This guide explains how to safely test WooCommerce checkout flows with Flowguard without creating real orders or affecting your store data.

Before You Start

Always enable Test Mode before testing WooCommerce flows! Without Test Mode, real orders will be created, stock will decrease, and emails will be sent.

Overview

Flowguard's Test Mode provides comprehensive protection for WooCommerce testing:

ProtectionWhat It Does
No Real OrdersOrders blocked from database
No Payment ChargesGateway requests intercepted
Stock ProtectionInventory unchanged
Coupon SafetyUsage counts unaffected
Customer AccountsNo test accounts created
Email PreventionEmails blocked or redirected

How It Works

When Test Mode is enabled and a flow runs:

  1. Order Creation Blocked: WooCommerce's order creation hooks are intercepted
  2. Database Queries Prevented: Direct database inserts to order tables are blocked
  3. HPOS Support: Compatible with both legacy wp_posts orders and High-Performance Order Storage (HPOS)
  4. Actions Logged: All prevented actions are logged for review in the flow results

Setting Up Test Mode

Enable Test Mode

  1. Navigate to Flowguard → Settings → Test Mode
  2. Enable the Test Mode toggle
  3. Configure email handling (Block or Rewrite to test address)
  4. Save settings

Email Strategy

Choose how to handle WooCommerce emails during tests:

  • Block: Completely prevent emails from being sent (recommended)
  • Rewrite: Send all emails to a test email address instead

Creating WooCommerce Flows

Use standard Flowguard steps to create your WooCommerce test flows:

Example Flow: Complete Checkout

yaml
1. Open Page
   - URL: https://yoursite.com/product/test-product

2. Click (Add to Cart)
   - Selector: button[name="add-to-cart"]

3. Wait
   - Time: 1000

4. Click (View Cart)
   - Selector: .cart-button

5. Click (Proceed to Checkout)
   - Selector: .checkout-button

6. Type Text (First Name)
   - Selector: #billing_first_name
   - Value: John

7. Type Text (Last Name)
   - Selector: #billing_last_name
   - Value: Doe

8. Type Text (Email)
   - Selector: #billing_email
   - Value: test@example.com

9. Type Text (Address)
   - Selector: #billing_address_1
   - Value: 123 Test St

10. Type Text (City)
    - Selector: #billing_city
    - Value: Test City

11. Type Text (Postcode)
    - Selector: #billing_postcode
    - Value: 12345

12. Type Text (Phone)
    - Selector: #billing_phone
    - Value: 555-0123

13. Click (Select Payment - Flowguard Test Payment)
    - Selector: #payment_method_flowguard_test

14. Click (Place Order)
    - Selector: #place_order

15. Wait
    - Time: 3000

16. Check (Assert)
    - Selector: .woocommerce-notice
    - Expected: "Thank you"

Tips for Recording Flows:

  • Use the Selector Picker in the Flow Editor to easily select elements
  • Add Wait steps after important actions (add to cart, place order)
  • Use descriptive names for your steps (include what they do in parentheses)
  • Test your selectors on different themes if you plan to reuse flows

Testing Scenarios

Guest Checkout

Test the checkout process without requiring customer login:

  1. Add product to cart
  2. Proceed to checkout
  3. Fill billing details (without creating account)
  4. Select payment method
  5. Place order
  6. Verify order confirmation message

Coupon Application

Test coupon functionality:

  1. Add product to cart
  2. View cart
  3. Apply coupon (using coupon code)
  4. Verify discount is applied (use Assert step)
  5. Proceed to checkout
  6. Place order

Note: In Test Mode, coupon usage counts will NOT increase, so you can test the same coupon repeatedly.

Customer Account Creation

Test account creation during checkout:

  1. Add product to cart
  2. Proceed to checkout
  3. Fill billing details
  4. Check "Create an account" checkbox
  5. Place order

Note: In Test Mode, no actual user account is created in the database.

Payment Gateway Testing

Required: Use Flowguard Test Payment Gateway

For WooCommerce test flows, you MUST use the Flowguard Test Payment Gateway! This is the only safe way to test checkout flows.

Flowguard provides a special test payment gateway that is only visible during test runs:

FeatureBenefit
✅ Simulates paymentsNo real transactions
✅ Works in Test ModeFully integrated
✅ Auto-appears in testsNo setup needed
✅ Completely safeNo orders or charges
✅ Hidden from customersOnly visible in tests

How to Use in Your Test Flows:

  1. Enable Test Mode in Flowguard > Settings > Test Mode
  2. Create your checkout flow as normal
  3. When selecting the payment method, choose 🧪 Test Payment (Flowguard)
  4. The gateway will be visible in the payment methods list during test execution
  5. Complete the checkout - the payment will be simulated successfully

Example Selector:

yaml
Click (Select Flowguard Test Payment)
- Selector: #payment_method_flowguard_test

Why Use Flowguard Test Payment Gateway?

  • Standard payment gateways (Stripe, PayPal, etc.) have their external API requests blocked in Test Mode
  • The Flowguard Test Gateway is specifically designed for automated testing
  • No sandbox credentials or complex setup required
  • Instant, reliable payment simulation

Testing Other Payment Gateways

If you need to test specific payment gateway features:

  1. Set up test/sandbox credentials for your payment gateway
  2. Disable Test Mode temporarily (or use a separate flow)
  3. Create a flow that selects the payment method
  4. Use the gateway's sandbox/test mode for safe testing

Important:

  • All external HTTP requests to payment gateways are blocked in Flowguard Test Mode
  • Gateway API calls will not be made when Test Mode is active
  • For detailed payment gateway testing, use the gateway's own sandbox mode outside of Flowguard Test Mode
  • For general checkout flow testing, always use the Flowguard Test Payment Gateway

What's Blocked in Test Mode

WooCommerce Orders

Blocked:

  • Order creation via woocommerce_new_order hook
  • Order creation via wc_create_order() function
  • Direct database inserts to wp_wc_orders (HPOS)
  • Direct database inserts to wp_woocommerce_order_items
  • Order meta updates

Stock Management

Blocked:

  • Stock quantity reductions
  • Stock quantity increases (refunds)
  • Product meta updates for stock

Coupons

Blocked:

  • Coupon usage count increases
  • Coupon usage tracking

Allowed:

  • Coupon validation (coupons will still validate normally)
  • Discount calculations

Customer Accounts

Blocked:

  • Customer user creation
  • Customer meta updates
  • Customer session data (persistent)

Emails

Blocked/Redirected:

  • Order confirmation emails
  • Customer invoice emails
  • Admin new order notifications
  • All other WooCommerce emails

Payment Gateways

Blocked:

  • All external HTTP requests to:
    • Stripe API
    • PayPal API
    • Square API
    • Other payment processors

Reviewing Test Results

After running a WooCommerce flow in Test Mode:

  1. Go to Flowguard → Flows
  2. Click on your flow
  3. View the Test Logs tab

Test Log Categories

WooCommerce Logs:

  • Order creation attempts
  • Stock reduction attempts
  • Coupon usage attempts
  • Customer creation attempts
  • Payment gateway selections

Database Logs:

  • Prevented database queries
  • Post/meta operations

Email Logs:

  • Blocked or rewritten emails
  • Recipients and subjects

HTTP Logs:

  • Blocked payment gateway requests
  • External API calls

Common WooCommerce Selectors

Here are typical selectors for WooCommerce elements to help you build your flows:

Product Pages

  • Add to cart button: button[name="add-to-cart"], .single_add_to_cart_button
  • Quantity input: input.qty, input[name="quantity"]
  • Variation selects: select[id^="pa_"] (e.g., #pa_size, #pa_color)

Cart Page

  • Cart button: .cart-button, .wc-proceed-to-checkout a
  • Checkout button: .checkout-button, a.checkout-button
  • Coupon input: #coupon_code
  • Apply coupon button: button[name="apply_coupon"]
  • Update cart button: button[name="update_cart"]

Checkout Page

  • Billing fields: #billing_first_name, #billing_last_name, #billing_email, etc.
  • Shipping checkbox: #ship-to-different-address-checkbox
  • Shipping fields: #shipping_first_name, #shipping_address_1, etc.
  • Payment methods:
    • Flowguard Test Payment (Recommended): #payment_method_flowguard_test
    • Bank Transfer: #payment_method_bacs
    • Stripe: #payment_method_stripe
    • PayPal: #payment_method_paypal
  • Terms checkbox: #terms
  • Place order button: #place_order, button[name="woocommerce_checkout_place_order"]

Order Confirmation

  • Success notice: .woocommerce-notice--success, .woocommerce-thankyou-order-received
  • Order number: .woocommerce-order-overview__order, .order-number

Best Practices

#1: Always Enable Test Mode

Never run WooCommerce flows without Test Mode enabled unless you intend to create real orders.

2. Use Test Products

Create dedicated test products:

SettingRecommendation
Price$0.01 or $1.00
SKUTEST-001, TEST-002
Name"TEST - Product Name"
StockUnlimited or high quantity

3. Create Dedicated Test Coupons

Test Coupon Setup

  • Usage limit: None (unlimited)
  • Naming: TEST-COUPON-20, TEST-FREESHIP
  • Document: Keep a list for your team

4. Use Flowguard Test Payment Gateway

Payment Gateway Selection

GatewaySafetyRecommendation
Flowguard Test Payment✅ SafeUSE THIS!
Bank Transfer (bacs)⚠️ RiskyMay create orders
Cash on Delivery (cod)⚠️ RiskyMay create orders
Check Payment (cheque)⚠️ RiskyMay create orders
Stripe/PayPal/External❌ BlockedUse sandbox mode separately

5. Use the Selector Picker

The Flow Editor includes a Selector Picker tool:

  • Click the crosshair icon in the Step Config panel
  • Click on any element in the preview
  • The selector is automatically filled in
  • Saves time and reduces selector errors

6. Add Descriptive Names

✅ Good❌ Bad
"Click (Add to Cart)""Click"
"Fill (Billing Email)""Fill"
"Select (Shipping Method)""Select"

7. Monitor Test Logs

After Every Test Run, Check:

  • [ ] Orders were properly blocked
  • [ ] Stock was not reduced
  • [ ] No emails sent to real customers

8. Cleanup After Testing

Even though Test Mode prevents data changes:

  • Clear test carts/sessions periodically
  • Review and delete any data created before Test Mode was enabled

Compatibility

WooCommerce Versions

Flowguard's WooCommerce Test Mode is compatible with:

  • WooCommerce 5.0+
  • WooCommerce 8.0+ (HPOS support)
  • WooCommerce 9.0+

Payment Gateways

Compatible with all standard WooCommerce payment gateways:

  • WooCommerce core payment methods (Bank Transfer, Check, COD)
  • Stripe for WooCommerce
  • PayPal Standard/Express
  • Square
  • Authorize.net
  • And any other gateway that follows WooCommerce standards

Themes

The test mode protection works with any WooCommerce-compatible theme. However, selectors may vary between themes:

For standard themes: Use common selectors listed above For custom themes: Use the Selector Picker to identify the correct elements

Troubleshooting

Flow Fails at "Place Order"

Problem: Flow times out or fails when clicking "Place Order"

Solutions:

  1. Increase the wait time after the Place Order step
  2. Check if there's a payment gateway redirect being blocked
  3. Review test logs for JavaScript errors
  4. Verify the payment method is available in Test Mode

Coupon Not Applying

Problem: Coupon validation fails during test

Solutions:

  1. Verify the coupon exists and is active
  2. Check coupon usage restrictions (user/email limits)
  3. Ensure coupon date range is valid
  4. Test coupon manually first

"Order Not Found" After Checkout

Problem: Flow expects an order confirmation but sees an error

Solution: This is normal in Test Mode! The order is not created, so WooCommerce may show an error. Instead:

  1. Use Assert steps to check for error messages
  2. Verify the checkout form was submitted
  3. Check test logs to confirm order creation was blocked

Stock Still Decreasing

Problem: Product stock is being reduced despite Test Mode

Solutions:

  1. Verify Test Mode is enabled in Settings
  2. Check that the flowguard_preview=1 parameter is in the URL during flow execution
  3. Review test logs to ensure WooCommerce interceptors are active
  4. Ensure WooCommerce is active and detected

Advanced Usage

Testing Multiple Products

yaml
1. Open Page
   - URL: https://yoursite.com/product/product-1

2. Click (Add Product 1)
   - Selector: button[name="add-to-cart"]

3. Wait
   - Time: 1000

4. Open Page
   - URL: https://yoursite.com/product/product-2

5. Click (Add Product 2)
   - Selector: button[name="add-to-cart"]

6. Wait
   - Time: 1000

7. Open Page
   - URL: https://yoursite.com/cart

8. Check (Assert - Multiple Items)
   - Selector: .cart-contents-count
   - Expected: "2"

Testing Variable Products

yaml
1. Open Page
   - URL: https://yoursite.com/product/variable-product

2. Select Option (Size)
   - Selector: #pa_size
   - Value: large

3. Wait
   - Time: 500

4. Select Option (Color)
   - Selector: #pa_color
   - Value: blue

5. Wait
   - Time: 500

6. Click (Add to Cart)
   - Selector: button[name="add-to-cart"]

Testing Shipping Methods

yaml
1. [... add products and proceed to checkout ...]

2. Toggle Checkbox (Ship to Different Address)
   - Selector: #ship-to-different-address-checkbox
   - Checked: true

3. Type Text (Shipping First Name)
   - Selector: #shipping_first_name
   - Value: Jane

4. [... fill remaining shipping fields ...]

5. Click (Select Flat Rate Shipping)
   - Selector: #shipping_method_0_flat_rate

6. Wait (Shipping Calculation)
   - Time: 1000

7. Check (Assert Total Includes Shipping)
   - Selector: .order-total .amount
   - Expected: "$"

Support

If you encounter issues with WooCommerce testing:

  1. Check this documentation
  2. Review test logs in flow results
  3. Verify Test Mode is enabled
  4. Check WooCommerce compatibility
  5. Contact support with:
    • WooCommerce version
    • Payment gateway used
    • Theme name
    • Test logs export