woo-performance
Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.
Best use case
woo-performance is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.
Teams using woo-performance should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/woo-performance/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How woo-performance Compares
| Feature / Agent | woo-performance | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Optimize WooCommerce performance — object caching, transients, HPOS, database optimization, Action Scheduler, lazy loading, and query optimization. Use when improving store performance or diagnosing slowness.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# WooCommerce Performance Optimization ## Before writing code **Fetch live docs**: 1. Web-search `site:developer.woocommerce.com performance` for performance guide 2. Web-search `woocommerce hpos performance benefits` for HPOS optimization details 3. Web-search `wordpress object caching best practices` for caching patterns ## HPOS (High-Performance Order Storage) ### Why It Matters HPOS moves orders from `wp_posts`/`wp_postmeta` to dedicated tables: - Dramatically faster order queries (custom indexes) - Reduces `wp_posts` table bloat - Better database performance at scale - Required for WooCommerce's future direction ### Enabling HPOS WooCommerce > Settings > Advanced > Features: - Enable "Custom order tables" - Run the migration tool to migrate existing orders - Enable "Sync" during transition period - Once verified, disable sync and use custom tables as authoritative ### Compatibility Requirements Extensions must: - Use CRUD methods (`$order->get_meta()`, `$order->set_status()`, `$order->save()`) - NOT use `get_post_meta()` / `update_post_meta()` on orders - NOT use `WP_Query` with `post_type => 'shop_order'` - Declare compatibility via `FeaturesUtil::declare_compatibility()` ## Object Caching ### WordPress Object Cache `wp_cache_get()` / `wp_cache_set()` — in-memory cache per request: - With Redis/Memcached: persistent across requests - Always use cache groups: `wp_cache_set( $key, $data, 'my_plugin' )` - Set appropriate expiration - Use `wp_cache_delete()` when data changes ### Transients `set_transient()` / `get_transient()` — cached values with expiration: - Stored in DB without object cache, in-memory with object cache - Use for: API responses, computed values, rate calculations - Always handle cache miss (regenerate data when transient expires) - Delete transients when underlying data changes ### WooCommerce Cache Helpers - `WC_Cache_Helper` — manages WooCommerce-specific caching - `wc_get_transient_version( 'product' )` — cache versioning for products - Cache invalidation on product/order changes via version bumps ## Database Optimization ### Query Optimization - Use `wc_get_orders()` / `wc_get_products()` instead of `WP_Query` - Limit queries: always use `limit`/`per_page` parameters - Avoid `meta_query` on large tables — use HPOS custom columns instead - Use `'fields' => 'ids'` when you only need IDs - Avoid `'no_found_rows' => false` on large result sets ### Index Optimization - Ensure custom tables have proper indexes on queried columns - WooCommerce HPOS tables include optimized indexes by default - For custom tables: add indexes on columns used in WHERE, JOIN, ORDER BY ### Background Processing Move heavy operations out of the request cycle: - **Action Scheduler** — WooCommerce's job queue - Schedule: `as_schedule_single_action( $timestamp, 'hook_name', $args )` - Recurring: `as_schedule_recurring_action( $timestamp, $interval, 'hook_name', $args )` - Handles retries, failure logging, and concurrent execution ## Frontend Performance ### Asset Loading - Conditionally load CSS/JS only on relevant pages - Use `wp_enqueue_script` with `strategy => 'defer'` or `'async'` - Combine/minify assets in production - Use `wp_script_add_data( $handle, 'strategy', 'defer' )` ### Cart Fragments AJAX cart fragment refreshing can be a bottleneck: - Filter `woocommerce_cart_fragments` to minimize data - Disable on pages where cart widget isn't shown - Use `wc_cart_fragments_params` localized data ### Image Optimization - Use WordPress responsive images (`srcset`, `sizes`) - Enable lazy loading: `loading="lazy"` on product images - Use WebP format where supported - Configure image sizes: `add_image_size()` and WooCommerce image settings ## Action Scheduler ### Using Action Scheduler WooCommerce's built-in background job processor: - `as_schedule_single_action( time(), 'my_hook', $args, 'my-group' )` — run once - `as_schedule_recurring_action( time(), HOUR_IN_SECONDS, 'my_hook', $args )` — recurring - `as_enqueue_async_action( 'my_hook', $args )` — ASAP execution - `as_unschedule_action( 'my_hook', $args )` — cancel - Monitor via WooCommerce > Status > Scheduled Actions ### When to Use - Sending batch emails - Syncing inventory with external systems - Generating reports - Processing large data imports/exports - Cleaning up expired data ## Best Practices - Enable HPOS for new stores and migrate existing ones - Use persistent object cache (Redis/Memcached) in production - Cache expensive computations and API responses with transients - Use Action Scheduler for background processing — never process heavy tasks during HTTP requests - Profile with Query Monitor plugin to identify slow queries - Conditionally load assets only on pages where needed - Use `wc_get_orders()` / `wc_get_products()` with appropriate limits - Avoid N+1 query patterns — batch load related data Fetch the WooCommerce performance documentation and HPOS migration guide for exact configuration, migration steps, and optimization techniques before implementing.
Related Skills
spree-performance
Profile and optimize a Spree application — N+1 queries with bullet/scout, database indexing strategy for Spree's polymorphic associations, Rails fragment + Russian doll caching, ActiveStorage variant pre-generation, Sidekiq queue tuning, MeiliSearch vs Postgres FTS tradeoffs, Puma worker/thread sizing, CDN strategy for catalog pages, asset precompile time, and load testing. Use when Spree is slow, the database is hot, or you're preparing for a traffic spike (Black Friday, launch).
shopify-performance
Optimize Shopify performance — Liquid rendering, asset optimization, CDN strategies, Core Web Vitals, Hydrogen caching, image optimization, preloading, and lazy loading. Use when improving Shopify store speed.
sf-performance
Optimize Salesforce Commerce performance — B2C (cartridge caching, CDN configuration, ISML rendering optimization, lazy loading) and B2B (SOQL optimization, LWC lazy loading, Apex bulkification). Both platforms target Core Web Vitals and image optimization.
magento-performance
Optimize Magento 2 performance — full page cache (Varnish), Redis, indexer tuning, JavaScript/CSS optimization, database optimization, and profiling. Use when diagnosing slow pages, optimizing load times, or configuring caching.
bc-performance
Optimize BigCommerce storefront performance — CDN, image optimization, lazy loading, Stencil theme optimization, API response caching, GraphQL query efficiency, and Core Web Vitals. Use when improving store speed or diagnosing performance issues.
woo-testing
Test WooCommerce extensions — PHPUnit unit/integration tests, WP test suite, WooCommerce test helpers, E2E with Playwright, and WP-CLI test scaffolding. Use when writing tests for WooCommerce plugins or setting up a test environment.
woo-shipping
Build WooCommerce shipping methods — WC_Shipping_Method, shipping zones, shipping classes, rate calculation, tracking, and integration with carriers. Use when creating custom shipping integrations or configuring shipping logic.
woo-setup
Install WooCommerce, configure the development stack, and set up a local dev environment with WP-CLI, Docker, or wp-env. Use when setting up a new WooCommerce project or development environment.
woo-security
Implement WooCommerce security — nonces, capabilities, input sanitization, output escaping, data validation, PCI compliance considerations, and WordPress security best practices. Use when hardening a WooCommerce store or reviewing security posture.
woo-plugin-dev
Create WooCommerce extensions/plugins — file structure, main plugin file, activation/deactivation hooks, custom database tables, autoloading, and WordPress plugin API. Use when building new WooCommerce extensions or structuring plugin code.
woo-payments
Build WooCommerce payment gateways — WC_Payment_Gateway, direct/redirect/hosted integrations, tokenization, subscriptions support, refunds, and PCI compliance. Use when creating custom payment method integrations.
woo-hooks-filters
Master the WordPress hook system for WooCommerce — actions, filters, hook priorities, WooCommerce-specific hooks, and extensibility patterns. Use when adding functionality via hooks or understanding the WooCommerce execution flow.