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.

Always use the Flowguard Test Payment Gateway

When testing checkout flows, never enter real credit card details. Flowguard provides its own Test Payment Gateway that simulates a successful payment. No real transactions, no charges, no external services. It appears automatically during test runs as "πŸ§ͺ Test Payment (Flowguard)" in the payment methods. Simply select it instead of Stripe, PayPal, or any other gateway.

Overview ​

Flowguard's Test Mode protects your WooCommerce store during 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 select elements easily
  • Add Wait steps after actions like add to cart and 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 built for automated testing
  • No sandbox credentials or 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:

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 ​

GoodBad
"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
  • Any other gateway that follows WooCommerce standards

Themes ​

The test mode protection works with any WooCommerce-compatible theme. 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 run into 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