Skip to main content

Development Setup

Overview

This guide covers setting up a local development environment for the Walkers Game Ear WordPress site, including BigCommerce integration, custom plugins, and build tools.

Prerequisites

Required Software

SoftwareMinimum VersionPurpose
PHP7.4WordPress core requirement
MySQL5.6 / MariaDB 10.1Database
Node.js16.xAsset compilation
npm8.xPackage management
Composer2.xPHP dependency management
Git2.xVersion control
  • Laravel Herd or Local by Flywheel — Local WordPress environment
  • Sequel Pro or TablePlus — Database management
  • VS Code — Code editor
  • WP-CLI — WordPress command-line tool

Local Environment Setup

Herd is a fast, native PHP development environment for macOS and Windows.

  1. Install Herd: Download from herd.laravel.com

  2. Park directory:

    cd Z:\Herd  # or your projects folder
    herd park
  3. Create site:

    mkdir walkers
    cd walkers
    herd link walkershearingprotection
  4. Install WordPress:

    wp core download
    wp config create --dbname=wp_walkers --dbuser=root --dbpass= --dbhost=127.0.0.1
    wp core install --url=walkershearingprotection.test --title="Walkers" --admin_user=admin --admin_password=admin [email protected]

Option 2: Local by Flywheel

  1. Install Local: Download from localwp.com
  2. Create new site:
    • Site name: Walkers Game Ear
    • PHP: 7.4 or 8.0
    • Web server: Nginx
    • Database: MySQL 5.7
  3. Start site and note the local URL

Database Import

  1. Export from production/staging:

    wp db export walkers-backup.sql --ssh=production
  2. Import locally:

    wp db import walkers-backup.sql
  3. Search and replace URLs:

    wp search-replace 'walkershearingprotection.com' 'walkershearingprotection.test'

Repository Setup

Clone Repository

cd Z:\Repos  # or your repos folder
git clone [email protected]:rhino-group/walkers.git
cd walkers

Git Configuration

Recommended .gitignore (if not present):

# WordPress core
/wp-admin/
/wp-includes/
/wp-content/index.php
/wp-content/languages/
/wp-content/upgrade/
/wp-content/uploads/

# WordPress config
wp-config.php
wp-config-local.php
.htaccess

# Plugins (exclude custom)
/wp-content/plugins/*
!/wp-content/plugins/bigcommerce-suma/
!/wp-content/plugins/suma-*/

# Themes (exclude custom)
/wp-content/themes/*
!/wp-content/themes/suma-elementor/
!/wp-content/themes/suma-elementor-child/

# Build artifacts
node_modules/
vendor/
*.log
.DS_Store

Plugin Development Setup

Install Dependencies

For plugins with Composer dependencies:

# BigCommerce plugin
cd wp-content/plugins/bigcommerce-suma
composer install --no-dev

# Suma Dealer Locator
cd ../suma-dealer-locator
composer install

Theme Development Setup

Install Node Modules

cd wp-content/themes/suma-elementor
npm install

Development Build

Watch mode (auto-recompile on changes):

npm run watch

Tailwind CSS watch:

npm run tw:watch

Production Build

Before deploying to staging/production:

# Compile and minify assets
npm run prod

# Build Tailwind CSS
npm run tw:build

# Build Elementor widgets
npm run prod-widgets

BigCommerce API Setup

Create BigCommerce App

  1. Log into BigCommerce store
  2. Navigate to: Advanced Settings → API Accounts → Create API Account
  3. Account type: Store-level API account
  4. OAuth Scopes:
    • Products: Read-only (or Modify if syncing back)
    • Orders: Read-only
    • Customers: Modify
    • Carts: Modify
    • Checkouts: Modify
    • Channel: Modify
  5. Save credentials: Client ID, Secret, Access Token

Configure WordPress

  1. Navigate to: BigCommerce → Settings → API Credentials
  2. Enter credentials from BigCommerce
  3. Test connection: Click "Connect"
  4. Set channel: Select or create channel for this WordPress site
  5. Run initial import: Products → Import Now

Local API Testing

To avoid importing thousands of products locally:

  1. Disable automatic sync: Settings → Import → Set to "Never"
  2. Import select products:
    wp bigcommerce import products --limit=10
  3. Use staging data: Copy production database, use staging API credentials

Local Environment Variables

wp-config-local.php

Create a local config file (ignored by Git):

<?php
/**
* Local development configuration
*/

// Database
define('DB_NAME', 'wp_walkers');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_HOST', '127.0.0.1:3306');

// Debug mode
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
define('WP_DEBUG_LOG', true);
define('SCRIPT_DEBUG', true);

// BigCommerce (use sandbox)
define('BIGCOMMERCE_API_URL', 'https://api.bigcommerce.com');

Include in main wp-config.php:

if (file_exists(__DIR__ . '/wp-config-local.php')) {
require_once __DIR__ . '/wp-config-local.php';
}

Testing Integrations

Klaviyo (Local)

For local testing without sending real events:

  1. Use test API key: Get from Klaviyo → Settings → API Keys
  2. Disable on local:
    // functions.php
    if (WP_DEBUG) {
    add_filter('suma_klaviyo_enabled', '__return_false');
    }

BazaarVoice (Staging)

Use BazaarVoice staging environment:

  1. Settings: BazaarVoice → Settings
  2. Environment: Select "Staging"
  3. Site ID: Use staging site ID
  4. Test reviews: Will show staging data

Algolia (Development Index)

Create separate Algolia index for local:

  1. Algolia Dashboard: Create index walkers_dev
  2. WordPress Settings: WP Search with Algolia
  3. Index Prefix: Set to walkers_dev
  4. Re-index: Indices → Re-index

FacetWP (Local)

FacetWP requires re-indexing after database import:

  1. Navigate to: Settings → FacetWP → Settings
  2. Click: "Re-index"
  3. Wait: for indexing to complete (can take several minutes)

Development Workflow

Typical Development Day

  1. Start local environment: Open Herd or Local
  2. Pull latest code:
    git pull origin main
  3. Install dependencies:
    cd wp-content/themes/suma-elementor && npm install
  4. Start watch mode:
    npm run watch
  5. Make changes: Edit PHP, SCSS, JS files
  6. Test in browser: Check http://walkershearingprotection.test
  7. Commit changes:
    git add .
    git commit -m "Description of changes"
    git push origin feature-branch

Feature Branch Workflow

# Create feature branch
git checkout -b feature/new-widget

# Make changes and commit
git add .
git commit -m "Add new product comparison widget"

# Push to remote
git push origin feature/new-widget

# Create pull request on GitHub
# After approval, merge and delete branch

Code Standards

PHP: Follow WordPress Coding Standards

# Install PHP_CodeSniffer
composer global require "squizlabs/php_codesniffer=*"

# Check files
phpcs --standard=WordPress wp-content/themes/suma-elementor/inc/

JavaScript: ESLint with WordPress preset

npm install --save-dev eslint eslint-config-wordpress
npx eslint src/js/

CSS: Stylelint

npm install --save-dev stylelint stylelint-config-standard
npx stylelint "src/scss/**/*.scss"

Debugging

WordPress Debug Log

Enable in wp-config.php:

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

View log:

tail -f wp-content/debug.log

Query Monitor Plugin

Install for advanced debugging:

wp plugin install query-monitor --activate

Shows:

  • Database queries
  • PHP errors
  • Hooks fired
  • HTTP API calls
  • Environment info

Xdebug Setup

Herd includes Xdebug, just enable:

herd xdebug on

VS Code configuration (.vscode/launch.json):

{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/Users/you/Herd/walkers": "${workspaceFolder}"
}
}
]
}

Common Issues

BigCommerce Products Not Syncing

Problem: Products not importing locally
Solution:

  1. Check API credentials are correct
  2. Verify channel configuration
  3. Check WordPress cron is running: wp cron event list
  4. Run manual import: wp bigcommerce import products

Assets Not Compiling

Problem: npm run watch throws errors
Solution:

  1. Delete node_modules and package-lock.json
  2. Run npm install
  3. Check Node.js version: node -v (should be 16.x+)
  4. Clear npm cache: npm cache clean --force

Elementor Widgets Missing

Problem: Custom widgets not appearing in Elementor
Solution:

  1. Clear Elementor cache: Elementor → Tools → Regenerate CSS
  2. Check widget registration: wp-content/themes/suma-elementor/inc/class-elementor-widgets.php
  3. Verify widget files exist in inc/widgets/
  4. Check for PHP errors: wp-content/debug.log

FacetWP Not Filtering

Problem: Filters not working after database import
Solution:

  1. Re-index: Settings → FacetWP → Settings → Re-index
  2. Check permalinks: Settings → Permalinks → Save Changes
  3. Clear all caches
  4. Test with FacetWP debug mode: Add ?fwp_debug=true to URL

Deployment

Staging Deployment

# Build production assets
cd wp-content/themes/suma-elementor
npm run prod

# Commit built files
git add dist/
git commit -m "Build assets for staging"

# Push to staging branch
git push origin staging

On staging server:

cd /var/www/walkers-staging
git pull origin staging
wp cache flush

Production Deployment

  1. Test on staging: Verify all changes work
  2. Create release tag:
    git tag -a v1.2.0 -m "Release version 1.2.0"
    git push origin v1.2.0
  3. Merge to main:
    git checkout main
    git merge staging
    git push origin main
  4. Deploy to production: Via CI/CD or manual pull

Performance Testing

Local Performance Tools

Blackfire.io (profiling):

herd blackfire on

New Relic (monitoring):

  • Install New Relic PHP extension
  • Configure in php.ini

Speed Testing

Test page load times:

# Install Apache Bench
brew install httpd # macOS

# Test 100 requests, 10 concurrent
ab -n 100 -c 10 http://walkershearingprotection.test/

Resources

Documentation

Support

  • Rhino Group Internal: #walkers-dev Slack channel
  • BigCommerce Support: support.bigcommerce.com
  • Plugin Vendor Support: Via respective vendor portals

Next Steps