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:
| Protection | What It Does |
|---|---|
| No Real Orders | Orders blocked from database |
| No Payment Charges | Gateway requests intercepted |
| Stock Protection | Inventory unchanged |
| Coupon Safety | Usage counts unaffected |
| Customer Accounts | No test accounts created |
| Email Prevention | Emails blocked or redirected |
How It Works
When Test Mode is enabled and a flow runs:
- Order Creation Blocked: WooCommerce's order creation hooks are intercepted
- Database Queries Prevented: Direct database inserts to order tables are blocked
- HPOS Support: Compatible with both legacy
wp_postsorders and High-Performance Order Storage (HPOS) - Actions Logged: All prevented actions are logged for review in the flow results
Setting Up Test Mode
Enable Test Mode
- Navigate to Flowguard → Settings → Test Mode
- Enable the Test Mode toggle
- Configure email handling (Block or Rewrite to test address)
- 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
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:
- Add product to cart
- Proceed to checkout
- Fill billing details (without creating account)
- Select payment method
- Place order
- Verify order confirmation message
Coupon Application
Test coupon functionality:
- Add product to cart
- View cart
- Apply coupon (using coupon code)
- Verify discount is applied (use Assert step)
- Proceed to checkout
- 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:
- Add product to cart
- Proceed to checkout
- Fill billing details
- Check "Create an account" checkbox
- Place order
Note: In Test Mode, no actual user account is created in the database.
Payment Gateway Testing
Using Flowguard Test Payment Gateway (Recommended)
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:
| Feature | Benefit |
|---|---|
| ✅ Simulates payments | No real transactions |
| ✅ Works in Test Mode | Fully integrated |
| ✅ Auto-appears in tests | No setup needed |
| ✅ Completely safe | No orders or charges |
| ✅ Hidden from customers | Only visible in tests |
How to Use in Your Test Flows:
- Enable Test Mode in Flowguard > Settings > Test Mode
- Create your checkout flow as normal
- When selecting the payment method, choose 🧪 Test Payment (Flowguard)
- The gateway will be visible in the payment methods list during test execution
- Complete the checkout - the payment will be simulated successfully
Example Selector:
Click (Select Flowguard Test Payment)
- Selector: #payment_method_flowguard_testWhy 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:
- Set up test/sandbox credentials for your payment gateway
- Disable Test Mode temporarily (or use a separate flow)
- Create a flow that selects the payment method
- 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_orderhook - 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:
- Go to Flowguard → Flows
- Click on your flow
- 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
- Flowguard Test Payment (Recommended):
- 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:
| Setting | Recommendation |
|---|---|
| Price | $0.01 or $1.00 |
| SKU | TEST-001, TEST-002 |
| Name | "TEST - Product Name" |
| Stock | Unlimited 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
| Gateway | Safety | Recommendation |
|---|---|---|
| Flowguard Test Payment | ✅ Safe | USE THIS! |
| Bank Transfer (bacs) | ⚠️ Risky | May create orders |
| Cash on Delivery (cod) | ⚠️ Risky | May create orders |
| Check Payment (cheque) | ⚠️ Risky | May create orders |
| Stripe/PayPal/External | ❌ Blocked | Use 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:
- Increase the wait time after the Place Order step
- Check if there's a payment gateway redirect being blocked
- Review test logs for JavaScript errors
- Verify the payment method is available in Test Mode
Coupon Not Applying
Problem: Coupon validation fails during test
Solutions:
- Verify the coupon exists and is active
- Check coupon usage restrictions (user/email limits)
- Ensure coupon date range is valid
- 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:
- Use Assert steps to check for error messages
- Verify the checkout form was submitted
- Check test logs to confirm order creation was blocked
Stock Still Decreasing
Problem: Product stock is being reduced despite Test Mode
Solutions:
- Verify Test Mode is enabled in Settings
- Check that the
flowguard_preview=1parameter is in the URL during flow execution - Review test logs to ensure WooCommerce interceptors are active
- Ensure WooCommerce is active and detected
Advanced Usage
Testing Multiple Products
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
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
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:
- Check this documentation
- Review test logs in flow results
- Verify Test Mode is enabled
- Check WooCommerce compatibility
- Contact support with:
- WooCommerce version
- Payment gateway used
- Theme name
- Test logs export