{"slug":"woocommerce-setup-essentials","title":"WooCommerce Setup Essentials","tags":["woocommerce","ecommerce","setup","products","wp-cli"],"agent_summary":"WooCommerce installation sequence, essential wp-config.php settings for memory and revisions, key WooCommerce hooks for customizing product pages and checkout fields, WP-CLI WooCommerce commands, and performance optimizations.","trigger_phrases":["woocommerce setup","install woocommerce","woocommerce wp-config","woocommerce hooks","woocommerce performance","wc product create wp-cli","woocommerce cart fragments"],"runnable":true,"markdown":"\nWooCommerce setup sequence. Get foundations right before adding products.\n\n## Install Sequence\n\n1. Install WooCommerce plugin > Run setup wizard\n2. Set store location, currency, and tax options\n3. Add payment gateways (Stripe + PayPal minimum)\n4. Configure shipping zones and rates\n5. Enable automated tax or manually set rates\n6. Install Storefront theme or Elementor WooCommerce kit\n7. Wizard auto-creates: Shop, Cart, Checkout, My Account pages\n\n## Essential wp-config.php Settings\n\n```php\n// Increase limits for WooCommerce\ndefine('WP_MEMORY_LIMIT', '256M');\ndefine('WP_MAX_MEMORY_LIMIT', '512M');\n\n// Limit product revisions (reduces DB bloat)\nadd_filter('wp_revisions_to_keep', function($num, $post) {\n    return $post->post_type === 'product' ? 3 : $num;\n}, 10, 2);\n```\n\n## Key WooCommerce Hooks\n\n```php\n// Add content after product summary (priority 15 = after price)\nadd_action('woocommerce_after_single_product_summary', 'add_trust_badges', 15);\nfunction add_trust_badges() {\n    echo '<div class=\"trust-badges\">Free shipping on orders over $50</div>';\n}\n\n// Change add-to-cart button text\nadd_filter('woocommerce_product_single_add_to_cart_text', function() {\n    return 'Buy Now';\n});\n\n// Remove unnecessary checkout fields\nadd_filter('woocommerce_checkout_fields', function($fields) {\n    unset($fields['billing']['billing_company']);\n    unset($fields['billing']['billing_address_2']);\n    unset($fields['order']['order_comments']);\n    return $fields;\n});\n```\n\n## WP-CLI WooCommerce Operations\n\n```bash\n# List products\nwp wc product list --user=admin\n\n# Create a simple product\nwp wc product create \\\n  --name=\"Service Package\" \\\n  --type=simple \\\n  --regular_price=299 \\\n  --status=publish \\\n  --user=admin\n\n# List pending orders\nwp wc order list --status=pending --user=admin\n\n# Clean up WooCommerce sessions\nwp wc tools run cleanup_sessions --user=admin\n```\n\n## Performance Optimizations\n\n| Issue | Fix |\n|-------|-----|\n| Slow pages from cart fragments JS | Perfmatters > Disable cart fragments on non-shop pages |\n| Too many product variations | Keep under 50 per product |\n| DB bloat from sessions | Run `cleanup_sessions` weekly via WP-CLI or cron |\n| High memory usage | Ensure PHP 8.1+, 256MB RAM minimum |\n| Slow checkout | Enable WooCommerce block-based checkout |\n","html":"<p>WooCommerce setup sequence. Get foundations right before adding products.</p>\n<h2>Install Sequence</h2>\n<ol>\n<li>Install WooCommerce plugin > Run setup wizard</li>\n<li>Set store location, currency, and tax options</li>\n<li>Add payment gateways (Stripe + PayPal minimum)</li>\n<li>Configure shipping zones and rates</li>\n<li>Enable automated tax or manually set rates</li>\n<li>Install Storefront theme or Elementor WooCommerce kit</li>\n<li>Wizard auto-creates: Shop, Cart, Checkout, My Account pages</li>\n</ol>\n<h2>Essential wp-config.php Settings</h2>\n<pre><code class=\"language-php\">// Increase limits for WooCommerce\ndefine('WP_MEMORY_LIMIT', '256M');\ndefine('WP_MAX_MEMORY_LIMIT', '512M');\n\n// Limit product revisions (reduces DB bloat)\nadd_filter('wp_revisions_to_keep', function($num, $post) {\n    return $post->post_type === 'product' ? 3 : $num;\n}, 10, 2);\n</code></pre>\n<h2>Key WooCommerce Hooks</h2>\n<pre><code class=\"language-php\">// Add content after product summary (priority 15 = after price)\nadd_action('woocommerce_after_single_product_summary', 'add_trust_badges', 15);\nfunction add_trust_badges() {\n    echo '&#x3C;div class=\"trust-badges\">Free shipping on orders over $50&#x3C;/div>';\n}\n\n// Change add-to-cart button text\nadd_filter('woocommerce_product_single_add_to_cart_text', function() {\n    return 'Buy Now';\n});\n\n// Remove unnecessary checkout fields\nadd_filter('woocommerce_checkout_fields', function($fields) {\n    unset($fields['billing']['billing_company']);\n    unset($fields['billing']['billing_address_2']);\n    unset($fields['order']['order_comments']);\n    return $fields;\n});\n</code></pre>\n<h2>WP-CLI WooCommerce Operations</h2>\n<pre><code class=\"language-bash\"># List products\nwp wc product list --user=admin\n\n# Create a simple product\nwp wc product create \\\n  --name=\"Service Package\" \\\n  --type=simple \\\n  --regular_price=299 \\\n  --status=publish \\\n  --user=admin\n\n# List pending orders\nwp wc order list --status=pending --user=admin\n\n# Clean up WooCommerce sessions\nwp wc tools run cleanup_sessions --user=admin\n</code></pre>\n<h2>Performance Optimizations</h2>\n<p>| Issue | Fix |\n|-------|-----|\n| Slow pages from cart fragments JS | Perfmatters > Disable cart fragments on non-shop pages |\n| Too many product variations | Keep under 50 per product |\n| DB bloat from sessions | Run <code>cleanup_sessions</code> weekly via WP-CLI or cron |\n| High memory usage | Ensure PHP 8.1+, 256MB RAM minimum |\n| Slow checkout | Enable WooCommerce block-based checkout |</p>\n"}