PHPackages                             woocommerce/wc-smooth-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. woocommerce/wc-smooth-generator

ActiveWordpress-plugin[Testing &amp; Quality](/categories/testing)

woocommerce/wc-smooth-generator
===============================

A smooth product, order, customer, and coupon generator for WooCommerce.

1.3.0(4mo ago)37819.0k—1.9%61[15 issues](https://github.com/woocommerce/wc-smooth-generator/issues)[12 PRs](https://github.com/woocommerce/wc-smooth-generator/pulls)GPL-3.0-or-laterPHPPHP &gt;=7.4CI passing

Since Nov 7Pushed 2mo ago88 watchersCompare

[ Source](https://github.com/woocommerce/wc-smooth-generator)[ Packagist](https://packagist.org/packages/woocommerce/wc-smooth-generator)[ Docs](https://woocommerce.com/)[ RSS](/packages/woocommerce-wc-smooth-generator/feed)WikiDiscussions trunk Synced 2d ago

READMEChangelog (8)Dependencies (10)Versions (45)Used By (0)

WooCommerce Smooth Generator
============================

[](#woocommerce-smooth-generator)

Generate realistic WooCommerce products, orders, customers, coupons, taxonomy terms, and bookings for development, testing, and demos.

WP-CLI is the primary interface. A limited WP Admin UI is also available at Dashboard &gt; Tools &gt; WooCommerce Smooth Generator.

Installation
------------

[](#installation)

**From GitHub releases (recommended):**

1. Download the latest zip from [GitHub Releases](https://github.com/woocommerce/wc-smooth-generator/releases/).
2. Install via WP Admin &gt; Plugins &gt; Add New &gt; Upload Plugin.

**From source:**

```
git clone https://github.com/woocommerce/wc-smooth-generator.git
cd wc-smooth-generator
composer install --no-dev
```

Requirements
------------

[](#requirements)

- PHP 7.4+
- WordPress (tested up to 6.9)
- WooCommerce 5.0+
- [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/) (optional, required for booking generation)

WP-CLI commands
---------------

[](#wp-cli-commands)

All commands use the `wp wc generate` prefix. Run `wp help wc generate` for a summary, or `wp help wc generate ` for detailed usage.

### Products

[](#products)

```
# Generate 10 products (default, mix of simple and variable)
wp wc generate products

# Generate 25 simple products
wp wc generate products 25 --type=simple

# Generate variable products using only existing categories and tags
wp wc generate products 10 --type=variable --use-existing-terms

# Generate bookable products (requires WooCommerce Bookings)
wp wc generate products 5 --type=booking

# Generate bookable service products (requires WooCommerce Bookings + experimental features)
wp wc generate products 5 --type=bookable-service

# Generate bookable event products (requires WooCommerce Bookings + experimental features)
wp wc generate products 5 --type=bookable-event
```

OptionDescription``Number of products to generate. Default: `10``--type=`Product type: `simple`, `variable`, `booking`, `bookable-service`, or `bookable-event`. Default: random mix of simple/variable. `booking` requires [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/). `bookable-service` and `bookable-event` also require `WC_BOOKINGS_EXPERIMENTAL_ENABLED``--use-existing-terms`Only use existing categories and tags instead of generating new ones### Orders

[](#orders)

```
# Generate 10 orders for today's date
wp wc generate orders

# Generate orders with random dates in a range
wp wc generate orders 50 --date-start=2024-01-01 --date-end=2024-12-31

# Generate completed orders with a specific status
wp wc generate orders 20 --status=completed

# Apply coupons to half the orders
wp wc generate orders 100 --coupon-ratio=0.5

# Refund 30% of completed orders
wp wc generate orders 50 --status=completed --refund-ratio=0.3
```

OptionDescription``Number of orders to generate. Default: `10``--date-start=`Earliest order date (YYYY-MM-DD). Dates are randomized between this and today or `--date-end``--date-end=`Latest order date (YYYY-MM-DD). Requires `--date-start``--status=`Order status: `completed`, `processing`, `on-hold`, or `failed`. Default: random mix`--coupons`Apply a coupon to every order. Equivalent to `--coupon-ratio=1.0``--coupon-ratio=`Fraction of orders that get coupons (0.0-1.0). Creates 6 coupons if none exist (3 fixed cart, 3 percentage)`--refund-ratio=`Fraction of completed orders to refund (0.0-1.0). In batch mode: 50% full, 25% partial, 25% multi-partial. Single-order mode uses probabilistic distribution`--skip-order-attribution`Skip generating order attribution metadata**Batch distribution:** When generating multiple orders, coupon and refund counts are deterministic (selection without replacement). For odd totals, `round()` distributes coupons and remainders go to multi-partial refunds. Single-order generation uses probabilistic distribution.

**Order attribution:** Random attribution metadata (device type, UTM parameters, referrer, session data) is added by default. Orders dated before 2024-01-09 skip attribution, since the feature didn't exist in WooCommerce yet.

### Bookings

[](#bookings)

Requires the [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/) extension.

```
# Generate 10 bookings (requires at least one existing bookable product)
wp wc generate bookings

# Generate bookings with a specific date range
wp wc generate bookings 50 --date-start=2026-04-01 --date-end=2026-06-30

# Generate confirmed bookings for a specific bookable product
wp wc generate bookings 20 --status=confirmed --product-id=42

# Generate bookings without associated WooCommerce orders
wp wc generate bookings 30 --no-orders
```

OptionDescription``Number of bookings to generate. Default: `10``--date-start=`Earliest booking date (YYYY-MM-DD). Default: 14 days ago`--date-end=`Latest booking date (YYYY-MM-DD). Default: 42 days from now`--status=`Booking status: `unpaid`, `pending-confirmation`, `confirmed`, `paid`, `cancelled`, or `complete`. Default: weighted random mix`--product-id=`Use a specific bookable product for all bookings`--no-orders`Skip creating associated WooCommerce orders (orders are created by default)### Customers

[](#customers)

```
# Generate 10 customers (70% people, 30% companies)
wp wc generate customers

# Generate Spanish company customers
wp wc generate customers 20 --country=ES --type=company
```

OptionDescription``Number of customers to generate. Default: `10``--country=`ISO 3166-1 alpha-2 country code (e.g., `US`, `ES`, `CN`). Localizes names and addresses. Default: random from store selling locations`--type=`Customer type: `person` or `company`. Default: 70/30 mix### Coupons

[](#coupons)

```
# Generate 10 coupons with default discount range (5-100)
wp wc generate coupons

# Generate percentage coupons between 5% and 25%
wp wc generate coupons 20 --discount_type=percent --min=5 --max=25
```

OptionDescription``Number of coupons to generate. Default: `10``--min=`Minimum discount amount. Default: `5``--max=`Maximum discount amount. Default: `100``--discount_type=`Discount type: `fixed_cart` or `percent`. Default: `fixed_cart`### Terms

[](#terms)

```
# Generate 10 product tags
wp wc generate terms product_tag 10

# Generate hierarchical product categories
wp wc generate terms product_cat 50 --max-depth=3

# Generate child categories under an existing category
wp wc generate terms product_cat 10 --parent=123
```

OptionDescription``Required. Taxonomy to generate terms for: `product_cat` or `product_tag```Number of terms to generate. Default: `10``--max-depth=`Maximum hierarchy depth (1-5). Only applies to `product_cat`. Default: `1` (flat)`--parent=`Create all terms as children of this existing term ID. Only applies to `product_cat`Programmatic usage
------------------

[](#programmatic-usage)

All generators live in the `WC\SmoothGenerator\Generator` namespace and expose `generate()` and `batch()` static methods.

### Single objects

[](#single-objects)

```
use WC\SmoothGenerator\Generator;

// Generate and save a product (returns WC_Product or WP_Error).
$product = Generator\Product::generate( true, [ 'type' => 'simple' ] );

// Generate and save an order (returns WC_Order or false).
$order = Generator\Order::generate( true, [ 'status' => 'completed' ] );

// Generate and save a customer (returns WC_Customer or WP_Error).
$customer = Generator\Customer::generate( true, [ 'country' => 'US', 'type' => 'person' ] );

// Generate and save a booking (returns booking ID or WP_Error). Requires WooCommerce Bookings.
$booking_id = Generator\Booking::generate( true, [ 'status' => 'confirmed' ] );

// Generate and save a bookable product (returns WC_Product_Booking or WP_Error). Requires WooCommerce Bookings.
$booking_product = Generator\Product::generate( true, [ 'type' => 'booking' ] );

// Generate and save a bookable service product (returns WC_Product_Bookable_Service or WP_Error).
// Requires WooCommerce Bookings + WC_BOOKINGS_EXPERIMENTAL_ENABLED.
$service_product = Generator\Product::generate( true, [ 'type' => 'bookable-service' ] );

// Generate and save a bookable event product (returns WC_Product_Bookable_Event or WP_Error).
// Requires WooCommerce Bookings + WC_BOOKINGS_EXPERIMENTAL_ENABLED.
$event_product = Generator\Product::generate( true, [ 'type' => 'bookable-event' ] );

// Generate and save a coupon (returns WC_Coupon or WP_Error).
$coupon = Generator\Coupon::generate( true, [ 'min' => 5, 'max' => 25, 'discount_type' => 'percent' ] );

// Generate and save a term (returns WP_Term or WP_Error).
$term = Generator\Term::generate( true, 'product_cat', 0 );
```

### Batch generation

[](#batch-generation)

```
use WC\SmoothGenerator\Generator;

// Generate 50 products (returns array of product IDs or WP_Error).
// Max batch size: 100.
$product_ids = Generator\Product::batch( 50, [ 'type' => 'variable', 'use-existing-terms' => true ] );

// Generate 10 bookable products. Requires WooCommerce Bookings.
$booking_product_ids = Generator\Product::batch( 10, [ 'type' => 'booking' ] );

// Generate 100 orders with date range and coupons.
$order_ids = Generator\Order::batch( 100, [
    'date-start'   => '2024-01-01',
    'date-end'     => '2024-06-30',
    'status'       => 'completed',
    'coupon-ratio' => '0.3',
    'refund-ratio' => '0.2',
] );

// Generate 20 bookings with associated orders.
$booking_ids = Generator\Booking::batch( 20, [
    'date-start'  => '2026-04-01',
    'date-end'    => '2026-06-30',
    'with-orders' => true,
] );

// Generate 25 customers.
$customer_ids = Generator\Customer::batch( 25, [ 'country' => 'ES' ] );

// Generate 10 coupons.
$coupon_ids = Generator\Coupon::batch( 10, [ 'min' => 1, 'max' => 50 ] );

// Generate 20 hierarchical product categories.
$term_ids = Generator\Term::batch( 20, 'product_cat', [ 'max-depth' => 3 ] );
```

### Action hooks

[](#action-hooks)

Each generator fires an action after creating an object:

- `smoothgenerator_product_generated` -- after a product is saved
- `smoothgenerator_order_generated` -- after an order is saved
- `smoothgenerator_booking_generated` -- after a booking is saved (requires WooCommerce Bookings)
- `smoothgenerator_customer_generated` -- after a customer is saved
- `smoothgenerator_coupon_generated` -- after a coupon is saved
- `smoothgenerator_term_generated` -- after a term is saved

Available generators
--------------------

[](#available-generators)

### Product generator

[](#product-generator)

Creates simple, variable, booking, bookable-service, or bookable-event products with:

- Name, SKU, global unique ID, featured status
- Price, sale price, sale date scheduling
- Tax status and class, stock management
- Product image and gallery images (auto-generated)
- Categories, tags, and brands (if the `product_brand` taxonomy exists)
- Upsells and cross-sells from existing products
- Attributes and variations (for variable products)
- Virtual/downloadable flags, dimensions, weight
- Cost of Goods Sold (if WooCommerce COGS is enabled)
- Reviews allowed toggle, purchase notes, menu order

**Booking products** (requires [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/)):

- Hourly or daily duration with realistic names (consultations, rentals, venues)
- Person support with min/max counts and cost multiplier (~40% of products)
- Resource assignment with named resources like rooms and stations (~30% of products)
- Configurable availability windows (30-180 days)
- Cancellation settings

**Bookable-service products** (requires [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/) + `WC_BOOKINGS_EXPERIMENTAL_ENABLED`):

- Uses the real `WC_Product_Bookable_Service` class
- Virtual, fixed-duration services in minutes (haircuts, repairs, grooming)
- Duration always in minutes (15-60 min), enforced by the product class
- Default date availability set to non-available (per class defaults)
- No persons or resources (simple appointment-style bookings)
- Short availability windows (14-60 days)

**Bookable-event products** (requires [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/) + `WC_BOOKINGS_EXPERIMENTAL_ENABLED`):

- Uses the real `WC_Product_Bookable_Event` class
- Events with ticket-style bookings (concerts, workshops, conferences)
- Hour-based durations (1-4 hours)
- Person/attendee support with cost multiplier
- Availability windows (30-120 days)

### Order generator

[](#order-generator)

Creates orders with realistic data:

- Billing and shipping addresses from the customer
- Line items from existing products
- Random status distribution (or a specific status)
- Date randomization within a given range
- Coupon application with configurable ratio
- Refunds: full, partial, and multi-partial with realistic timing
- Order attribution: device type, UTM parameters, referrer, session data
- Extra fees (~20% chance per order)
- Paid and completed dates based on status

### Booking generator

[](#booking-generator)

Requires the [WooCommerce Bookings](https://woocommerce.com/products/woocommerce-bookings/) extension. Creates bookings with:

- Checks for WooCommerce Bookings dependency before proceeding
- Returns a clear error if no bookable products exist (create them first with `wp wc generate products --type=booking`)
- Random booking dates within a configurable range
- Weighted status distribution: paid (35%), confirmed (25%), complete (20%), unpaid (10%), pending-confirmation (5%), cancelled (5%)
- Person counts based on product configuration
- Resource assignment from product's available resources
- Associated WooCommerce orders with mapped statuses (optional)
- Customer assignment from existing customers or auto-created ones

### Customer generator

[](#customer-generator)

Creates customer accounts with localized data:

- Person (first/last name) or company profiles
- Localized names, emails, and phone numbers based on country
- Billing address with street, city, state, postcode
- Shipping address (50% chance; half copy billing, half are unique)
- Username and password

### Coupon generator

[](#coupon-generator)

Creates discount coupons:

- Auto-generated coupon codes
- Configurable discount range (min/max)
- Fixed cart or percentage discount type

### Term generator

[](#term-generator)

Creates taxonomy terms for products:

- Product categories (`product_cat`) with optional hierarchy (up to 5 levels deep)
- Product tags (`product_tag`)
- Auto-generated descriptions
- Child terms under a specified parent

Contributing
------------

[](#contributing)

Found a bug or want a feature? [Open an issue](https://github.com/woocommerce/wc-smooth-generator/issues) or submit a pull request.

### Development setup

[](#development-setup)

Requires Node.js v16 and Composer v2+.

```
npm run setup
```

This installs dependencies and sets up a pre-commit hook that lints PHP changes using the WooCommerce Core phpcs ruleset.

License
-------

[](#license)

[GPL-3.0-or-later](https://www.gnu.org/licenses/gpl-3.0.html)

###  Health Score

61

—

FairBetter than 98% of packages

Maintenance80

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community34

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor4

4 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~333 days

Recently: every ~268 days

Total

9

Last Release

134d ago

PHP version history (2 changes)1.1.0PHP ^7.4 || ^8.0

1.3.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/d1f9b32f9677791fbef38b00c9225e05800f525b3b13872b118fd344a58350a0?d=identicon)[woocommerce](/maintainers/woocommerce)

---

Top Contributors

[![coreymckrill](https://avatars.githubusercontent.com/u/916023?v=4)](https://github.com/coreymckrill "coreymckrill (92 commits)")[![rodrigoprimo](https://avatars.githubusercontent.com/u/77215?v=4)](https://github.com/rodrigoprimo "rodrigoprimo (32 commits)")[![rrennick](https://avatars.githubusercontent.com/u/343847?v=4)](https://github.com/rrennick "rrennick (31 commits)")[![kloon](https://avatars.githubusercontent.com/u/271630?v=4)](https://github.com/kloon "kloon (30 commits)")[![mikejolley](https://avatars.githubusercontent.com/u/90977?v=4)](https://github.com/mikejolley "mikejolley (22 commits)")[![budzanowski](https://avatars.githubusercontent.com/u/17271089?v=4)](https://github.com/budzanowski "budzanowski (22 commits)")[![rawdreeg](https://avatars.githubusercontent.com/u/4209011?v=4)](https://github.com/rawdreeg "rawdreeg (17 commits)")[![ovidiul](https://avatars.githubusercontent.com/u/537751?v=4)](https://github.com/ovidiul "ovidiul (15 commits)")[![layoutd](https://avatars.githubusercontent.com/u/228780?v=4)](https://github.com/layoutd "layoutd (15 commits)")[![michi-dev](https://avatars.githubusercontent.com/u/60227869?v=4)](https://github.com/michi-dev "michi-dev (10 commits)")[![zhongruige](https://avatars.githubusercontent.com/u/71906536?v=4)](https://github.com/zhongruige "zhongruige (8 commits)")[![shiki](https://avatars.githubusercontent.com/u/198826?v=4)](https://github.com/shiki "shiki (7 commits)")[![masteradhoc](https://avatars.githubusercontent.com/u/6242098?v=4)](https://github.com/masteradhoc "masteradhoc (6 commits)")[![Luc45](https://avatars.githubusercontent.com/u/9341686?v=4)](https://github.com/Luc45 "Luc45 (5 commits)")[![chihsuan](https://avatars.githubusercontent.com/u/4344253?v=4)](https://github.com/chihsuan "chihsuan (5 commits)")[![louwie17](https://avatars.githubusercontent.com/u/2240960?v=4)](https://github.com/louwie17 "louwie17 (4 commits)")[![jrfnl](https://avatars.githubusercontent.com/u/663378?v=4)](https://github.com/jrfnl "jrfnl (4 commits)")[![jonathansadowski](https://avatars.githubusercontent.com/u/363749?v=4)](https://github.com/jonathansadowski "jonathansadowski (4 commits)")[![tammullen](https://avatars.githubusercontent.com/u/24649833?v=4)](https://github.com/tammullen "tammullen (3 commits)")[![Biont](https://avatars.githubusercontent.com/u/4208996?v=4)](https://github.com/Biont "Biont (2 commits)")

---

Tags

developer-toolssample-datatestingwoocommercewordpresswp-cli

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/woocommerce-wc-smooth-generator/health.svg)

```
[![Health](https://phpackages.com/badges/woocommerce-wc-smooth-generator/health.svg)](https://phpackages.com/packages/woocommerce-wc-smooth-generator)
```

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k455.6M9.6k](/packages/symfony-dependency-injection)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[api-platform/state

API Platform state interfaces

274.9M136](/packages/api-platform-state)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.4k67.4M263](/packages/nelmio-api-doc-bundle)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M421](/packages/drupal-core-recommended)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
