WordPressJuly 11, 20268 min read

WooCommerce Setup: A Developer's Guide to Building an Online Store

Everything I do when setting up a WooCommerce store from scratch: hosting requirements, PHP configuration, performance tuning, and the developer patterns that save hours on every build.

JA

Jacob Almogela

Full Stack Developer

WooCommerce Setup: A Developer's Guide to Building an Online Store

WooCommerce powers around 40% of all online stores, more than Shopify, BigCommerce, and Magento combined. That market share comes with a tradeoff: flexibility and complexity in equal measure. A properly set up WooCommerce store built by a developer is faster, more secure, and easier to maintain than one assembled through a page builder. Here is the setup process I use from scratch.

Hosting and Server Requirements

WooCommerce is a PHP application. The server you pick is the single biggest performance variable. No amount of plugin optimization overcomes a slow host. For production stores, avoid shared hosting. A VPS on DigitalOcean, Vultr, or Hetzner with a properly configured LEMP stack consistently outperforms most managed WooCommerce plans at the same price point.

  • PHP 8.2+ — older versions lose security patches and have measurable performance gaps
  • MySQL 8.0+ or MariaDB 10.6+ — WooCommerce makes heavy use of HPOS (High-Performance Order Storage)
  • 256MB PHP memory limit minimum — 512MB recommended for stores with complex products
  • HTTPS with a valid SSL certificate — required for payment processing, not optional
  • Redis or Memcached for object caching — reduces database queries by 60–80% on high-traffic stores

WordPress and WooCommerce Installation

WP-CLI is the fastest way to set up WordPress on a server. What takes 15 minutes through the browser installer takes 90 seconds in the terminal. Install WordPress first, then WooCommerce as a plugin. Never use the one-click install bundles from hosting panels since they often ship outdated versions.

bash
# Install WordPress via WP-CLI
wp core download --locale=en_US
wp config create --dbname=store_db --dbuser=db_user --dbpass=secure_pass --dbhost=localhost
wp core install \
  --url=https://yourdomain.com \
  --title="Your Store Name" \
  --admin_user=admin \
  --admin_email=you@domain.com \
  --admin_password=strong_password

# Install and activate WooCommerce
wp plugin install woocommerce --activate

# Set recommended permalink structure for SEO
wp rewrite structure '/%postname%/' --hard
TIP

Always use a child theme with WooCommerce. WooCommerce template overrides live in your theme's /woocommerce/ folder. If you edit the parent theme directly, updates will wipe your changes.

Enable High-Performance Order Storage (HPOS)

WooCommerce 7.1+ ships with HPOS, a custom orders table that replaces the slow WP_Post based order storage. On stores with more than a few hundred orders, the query performance difference is dramatic. Enable it from WooCommerce, then Settings, then Advanced, then Features as soon as the store is set up, before order data accumulates.

php
// Verify HPOS is active programmatically
// Add to functions.php or a custom plugin
add_action('init', function() {
    if (class_exists('\Automattic\WooCommerce\Utilities\OrderUtil')) {
        $using_hpos = \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled();
        // Log or display status in admin dashboard
        if (defined('WP_DEBUG') && WP_DEBUG) {
            error_log('WooCommerce HPOS: ' . ($using_hpos ? 'enabled' : 'disabled'));
        }
    }
});

Conditionally Load WooCommerce Scripts

WooCommerce enqueues its CSS and JavaScript on every page by default, including the homepage, blog posts, and pages that have nothing to do with the store. On a site with a large non-store section this is dead weight. Restricting WooCommerce assets to store pages is one of the highest ROI performance changes you can make on any WooCommerce build.

php
// functions.php — only load WooCommerce styles/scripts on store pages
add_action('wp_enqueue_scripts', 'conditionally_load_wc_assets', 99);

function conditionally_load_wc_assets() {
    // is_woocommerce() covers shop, product, cart, checkout, account pages
    // is_cart() and is_checkout() are included but explicit for clarity
    if (
        ! is_woocommerce() &&
        ! is_cart() &&
        ! is_checkout() &&
        ! is_account_page()
    ) {
        // Dequeue WooCommerce styles
        wp_dequeue_style('woocommerce-general');
        wp_dequeue_style('woocommerce-layout');
        wp_dequeue_style('woocommerce-smallscreen');
        wp_dequeue_style('wc-block-style');

        // Dequeue WooCommerce scripts
        wp_dequeue_script('woocommerce');
        wp_dequeue_script('wc-cart-fragments');  // most expensive — runs on every page
        wp_dequeue_script('wc-add-to-cart');
    }
}
TIP

wc-cart-fragments makes an AJAX request on every page load to keep the cart count updated. On non-store pages this is pure overhead. Dequeuing it alone can improve TTFB by 200–400ms on shared hosting.

Payment Gateway Setup

WooCommerce ships with direct bank transfer, cheque, and cash on delivery out of the box. For online payments you need a gateway plugin. The choice depends on the store's country and customer base, but a few rules apply everywhere.

  • Stripe — best for US, UK, AU, EU stores. Native WooCommerce Stripe plugin is actively maintained
  • PayPal Payments — broadest global support, but higher fees than Stripe in most markets
  • PayMongo — best option for Philippine-based stores (GCash, Maya, credit cards, OTC)
  • Never store card data yourself — always use a tokenized gateway (Stripe, Braintree) that handles PCI compliance
  • Enable Stripe Payment Element over the legacy Card Element — it handles 3D Secure and local payment methods automatically

Database Optimization for Production

WooCommerce is database-heavy. Without periodic maintenance, the wp_options table bloats with transients, the action scheduler table fills up with thousands of completed jobs, and queries slow down. Schedule these cleanups via WP-Cron or a server cron.

php
// functions.php — clean up expired transients and wc_sessions weekly
add_action('wp_scheduled_delete', 'clean_woocommerce_database');

function clean_woocommerce_database() {
    global $wpdb;

    // Remove expired WooCommerce transients
    $wpdb->query(
        "DELETE FROM {$wpdb->options}
         WHERE option_name LIKE '_transient_wc_%'
         OR option_name LIKE '_transient_timeout_wc_%'"
    );

    // Remove old WooCommerce sessions (older than 48 hours)
    $wpdb->query(
        "DELETE FROM {$wpdb->prefix}woocommerce_sessions
         WHERE session_expiry < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 48 HOUR))"
    );

    // Delete completed action scheduler entries older than 30 days
    $wpdb->query(
        "DELETE FROM {$wpdb->prefix}actionscheduler_actions
         WHERE status = 'complete'
         AND scheduled_date_gmt < DATE_SUB(NOW(), INTERVAL 30 DAY)"
    );
}

Developer Checklist Before Launch

  • Child theme active with /woocommerce/ folder for template overrides
  • HPOS enabled and synced — check WooCommerce → Status → Tools
  • WooCommerce scripts dequeued on non-store pages
  • Payment gateway tested with real card in test mode — don't trust sandbox results alone
  • SSL active, HTTP → HTTPS redirect in place, no mixed-content warnings
  • Object caching (Redis) configured and verified via WooCommerce → Status
  • Database cleanup scheduled weekly via WP-Cron
  • wp_mail() tested — transactional emails (order confirmation, shipping) arrive reliably
  • Staging site locked with basic auth — never leave it indexed or publicly accessible
  • Backups automated to off-server storage (Updraft Plus to S3 or Google Drive)

WooCommerce rewards developers who understand PHP and the WordPress hook system. Most of the performance gains, custom functionality, and long-term maintainability do not come from plugins. They come from knowing where to hook in, when to dequeue, and how to keep the database clean. A store built this way stays fast at scale and does not need a plugin audit every six months to stay performant.

#WooCommerce#WordPress#PHP#eCommerce#Performance
© 2026 Jacob AlmogelaBuilt with Next.js + Framer Motion