# Fix WordPress WooCommerce Error
WooCommerce powers millions of online stores, but e-commerce complexity brings complex errors. Checkout fails silently, payments don't process, orders get stuck, or the entire store breaks. When WooCommerce errors hit, sales stop and customers leave.
Quick Diagnosis
Check WooCommerce Status
```bash # List WooCommerce system status wp wc tool list
# Run system status report wp wc tool run system_status_report --user=1
# Check WooCommerce version wp plugin list --name=woocommerce --fields=name,version,status ```
Check WooCommerce REST API
```bash # Test WooCommerce REST API curl -I https://yourdomain.com/wp-json/wc/v3/
# Should return 200 OK ```
Check Error Logs
```bash # WooCommerce logs wp wc tool list | grep -i log
# View WooCommerce logs wp wc log list --user=1 wp wc log view woocommerce-log-file --user=1
# WordPress debug log tail -100 wp-content/debug.log | grep -i woo ```
Common WooCommerce Errors
1. Checkout Error: "Error Processing Order"
Checkout fails with generic error message.
Enable WooCommerce debugging:
```bash # Enable logging wp option update woocommerce_logging_enabled 'yes'
# View logs for errors wp wc log list --user=1 ```
Check payment gateway:
```bash # List payment gateways wp wc payment_gateway list --user=1 --fields=id,title,enabled
# Check gateway settings wp option get woocommerce_stripe_settings wp option get woocommerce_paypal_settings ```
Fix gateway configuration:
# Update gateway settings
wp option update woocommerce_stripe_settings '{"enabled":"yes","testmode":"no","publishable_key":"pk_live_...","secret_key":"sk_live_..."}' --format=json2. Payment Processing Failed
Payments don't complete or return errors.
Check payment logs:
# View payment-specific logs
wp wc log view woocommerce-stripe --user=1
wp wc log view woocommerce-paypal --user=1Verify SSL for payments:
```bash # Payment gateways require SSL curl -I https://yourdomain.com/checkout/
# Check WooCommerce SSL setting wp option get woocommerce_force_ssl_checkout wp option update woocommerce_force_ssl_checkout 'yes' ```
Check API credentials:
```bash # Test Stripe API curl -s https://api.stripe.com/v1/charges \ -u "sk_test_your_key:" \ -H "Stripe-Version: 2023-10-16"
# Test PayPal API curl -s https://api-m.sandbox.paypal.com/v1/oauth2/token \ -u "client_id:secret" \ -d "grant_type=client_credentials" ```
3. Order Not Created / Stuck Orders
Orders stuck in pending or failed status.
Find stuck orders:
```bash # List pending orders wp wc shop_order list --status=pending --fields=id,status,total
# List failed orders wp wc shop_order list --status=failed --fields=id,status,total ```
Fix stuck order:
```bash # Update order status wp wc shop_order update 123 --status=completed
# Delete failed orders wp wc shop_order list --status=failed --field=id | xargs -I {} wp wc shop_order delete {} --force ```
Check order creation hooks:
```php // Debug order creation add_action('woocommerce_checkout_order_processed', function($order_id) { error_log("Order created: $order_id"); });
add_action('woocommerce_payment_complete', function($order_id) { error_log("Payment completed for order: $order_id"); }); ```
4. WooCommerce REST API 403/404
WooCommerce API returns errors.
Check API authentication:
```bash # Test with API keys curl -X GET "https://yourdomain.com/wp-json/wc/v3/orders" \ -u "consumer_key:consumer_secret"
# Generate new API keys wp wc api create --user=admin --description="New API Key" ```
Check REST API permissions:
```bash # Verify REST API is enabled wp option get woocommerce_api_enabled
# Enable if disabled wp option update woocommerce_api_enabled 'yes' ```
Fix rewrite rules:
wp rewrite flush --hard5. Cart Empty / Session Issues
Cart appears empty after adding items.
Check session handling:
```bash # Check WooCommerce session settings wp option get woocommerce_sessions_cleanup_enabled
# Clear stale sessions wp wc tool run clear_all_sessions --user=1 ```
Fix cookie issues:
// In wp-config.php
define('COOKIE_DOMAIN', false);
define('COOKIEPATH', '/');
define('SITECOOKIEPATH', '/');Check object cache:
# WooCommerce sessions use cache
wp cache flush
wp transient delete --all6. Product Not Showing
Products missing from shop page.
Check product status:
```bash # List products wp wc product list --fields=id,name,status,type
# Check product visibility wp wc product get 123 --fields=status,catalog_visibility ```
Fix product visibility:
# Update product visibility
wp wc product update 123 --catalog_visibility="visible" --status="publish"Check category assignments:
wp wc product get 123 --fields=categories7. Stock Not Updating
Inventory doesn't sync with orders.
Check stock management:
```bash # Check if stock management enabled wp option get woocommerce_manage_stock
# Check product stock settings wp wc product get 123 --fields=manage_stock,stock_quantity,stock_status ```
Force stock update:
```bash # Update stock manually wp wc product update 123 --stock_quantity=100
# Regenerate stock status wp wc tool run regenerate_stock_status --user=1 ```
Fix stock sync:
// Debug stock updates
add_action('woocommerce_product_set_stock', function($product) {
error_log("Stock updated for product: " . $product->get_id() . " to " . $product->get_stock_quantity());
});8. Shipping Not Calculating
Shipping options missing or wrong.
Check shipping zones:
```bash # List shipping zones wp wc shipping_zone list --user=1 --fields=id,name,order
# Check zone methods wp wc shipping_zone_method list 1 --user=1 ```
Check shipping classes:
wp wc shipping_class list --user=1Fix shipping settings:
```bash # Update shipping zone wp wc shipping_zone update 1 --name="United States" --order=1
# Add shipping method wp wc shipping_zone_method create 1 --method_id="flat_rate" --method_order=1 --enabled=true --user=1 ```
9. Coupon Not Working
Coupons don't apply or show errors.
Check coupon status:
```bash # List coupons wp wc coupon list --fields=id,code,status,discount_type,amount
# Check specific coupon wp wc coupon get 123 --fields=id,code,usage_limit,usage_count ```
Fix coupon:
# Update coupon
wp wc coupon update 123 --amount=20 --usage_limit=100 --status=publish10. WooCommerce Admin Slow
WooCommerce dashboard takes forever to load.
Run WooCommerce optimization:
```bash # Clear transients wp wc tool run clear_transients --user=1
# Regenerate product lookup tables wp wc tool run regenerate_product_lookup_tables --user=1
# Clear customer lookup cache wp wc tool run clear_customer_lookup_cache --user=1 ```
Optimize database:
# Optimize WooCommerce tables
wp db optimizeWooCommerce-Specific WP-CLI Commands
```bash # System tools wp wc tool run install_pages --user=1 wp wc tool run create_default_pages --user=1 wp wc tool run clear_transients --user=1 wp wc tool run clear_all_sessions --user=1 wp wc tool run regenerate_thumbnails --user=1 wp wc tool run regenerate_product_lookup_tables --user=1
# Database repair wp wc tool run fix_duplicate_orders --user=1 wp wc tool run fix_duplicate_post_meta --user=1 ```
Fix Plugin Conflicts
WooCommerce conflicts with many plugins.
```bash # Deactivate potential conflicting plugins wp plugin deactivate elementor wp plugin deactivate wp-rocket wp plugin deactivate wordfence
# Test WooCommerce wp wc product list --fields=id,name
# Reactivate one by one ```
Common conflicting plugins:
- Page builders that override templates
- Caching plugins that cache cart/checkout
- Security plugins that block REST API
- SEO plugins with aggressive redirects
Fix Theme Issues
WooCommerce requires theme compatibility.
```bash # Check theme declares WooCommerce support grep -r "woocommerce" wp-content/themes/$(wp theme list --status=active --field=name)/functions.php
# Test with default theme wp theme install twentytwentyfour --activate # Check WooCommerce works ```
Declare WooCommerce support:
// In functions.php
add_action('after_setup_theme', function() {
add_theme_support('woocommerce');
add_theme_support('wc-product-gallery-zoom');
add_theme_support('wc-product-gallery-lightbox');
add_theme_support('wc-product-gallery-slider');
});Fix Database Issues
WooCommerce tables can become corrupted.
```bash # Check WooCommerce tables wp db query "SHOW TABLES LIKE '%woocommerce%'"
# Repair WooCommerce tables wp db query "REPAIR TABLE wp_woocommerce_sessions" wp db query "REPAIR TABLE wp_woocommerce_order_items"
# Check for orphaned data wp db query "SELECT * FROM wp_postmeta WHERE post_id NOT IN (SELECT ID FROM wp_posts)" ```
Payment Gateway Specific Fixes
Stripe
```bash # Check Stripe settings wp option get woocommerce_stripe_settings --format=json
# Update Stripe webhook URL # Stripe dashboard should have: https://yourdomain.com/?wc-api=WC_Gateway_Stripe
# Test webhook curl -X POST https://yourdomain.com/?wc-api=WC_Gateway_Stripe \ -H "Stripe-Signature: test" \ -d '{"type":"payment_intent.succeeded"}' ```
PayPal
```bash # Check PayPal settings wp option get woocommerce_paypal_settings --format=json
# Verify webhook curl -I https://yourdomain.com/?wc-api=WC_Gateway_PayPal ```
Multi-Currency Issues
```bash # Check currency settings wp option get woocommerce_currency wp option get woocommerce_price_thousand_sep wp option get woocommerce_price_decimal_sep
# Update currency wp option update woocommerce_currency 'USD' ```
Verification
After fixes:
```bash # Test product listing wp wc product list --fields=id,name,price --per_page=5
# Test order creation wp wc shop_order create --customer_id=1 --line_items='[{"product_id":123,"quantity":1}]' --user=1
# Test REST API curl -u "ck_key:cs_secret" https://yourdomain.com/wp-json/wc/v3/products
# Test checkout page curl -I https://yourdomain.com/checkout/ ```
Quick Reference
| Error | Cause | Fix |
|---|---|---|
| Checkout error | Payment gateway | Check gateway logs, SSL |
| Payment failed | API credentials | Verify Stripe/PayPal keys |
| Order stuck | Status sync | Update status, check hooks |
| API 403 | Authentication | Regenerate API keys |
| Cart empty | Session/cookie | Clear sessions, fix cookies |
| Product missing | Visibility | Update product status |
| Stock wrong | Sync issue | Regenerate stock status |
| Shipping error | Zone settings | Configure shipping zones |
WooCommerce errors cascade from payments, orders, products, and configuration. Start with WooCommerce logs to see what's failing, then check payment gateway connections, order hooks, and database integrity.