为开发、测试和演示生成逼真的 WooCommerce 产品、订单、客户和优惠券。
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 > Tools > WooCommerce Smooth Generator.
From GitHub releases (recommended):
From source:
git clone https://github.com/woocommerce/wc-smooth-generator.git
cd wc-smooth-generator
composer install --no-devAll commands use the wp wc generate prefix. Run wp help wc generate for a summary, or wp help wc generate for detailed usage.
…| Option | Description |
|---|---|
| `` | 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. 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 |
# 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| Option | Description |
|---|---|
| `` | 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.
Requires the 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| Option | Description |
|---|---|
| `` | 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) |
# Generate 10 customers (70% people, 30% companies)
wp wc generate customers
# Generate Spanish company customers
wp wc generate customers 20 --country=ES --type=company| Option | Description |
|---|---|
| `` | 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 |
# 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| Option | Description |
|---|---|
| `` | 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 |
# 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| Option | Description |
|---|---|
| `` | 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 |
All generators live in the WC\SmoothGenerator\Generator namespace and expose generate() and batch() static methods.
……Each generator fires an action after creating an object:
smoothgenerator_product_generated -- after a product is savedsmoothgenerator_order_generated -- after an order is savedsmoothgenerator_booking_generated -- after a booking is saved (requires WooCommerce Bookings)smoothgenerator_customer_generated -- after a customer is savedsmoothgenerator_coupon_generated -- after a coupon is savedsmoothgenerator_term_generated -- after a term is savedCreates simple, variable, booking, bookable-service, or bookable-event products with:
product_brand taxonomy exists)Booking products (requires WooCommerce Bookings):
Bookable-service products (requires WooCommerce Bookings + WC_BOOKINGS_EXPERIMENTAL_ENABLED):
WC_Product_Bookable_Service classBookable-event products (requires WooCommerce Bookings + WC_BOOKINGS_EXPERIMENTAL_ENABLED):
WC_Product_Bookable_Event classCreates orders with realistic data:
Requires the WooCommerce Bookings extension. Creates bookings with:
wp wc generate products --type=booking)Creates customer accounts with localized data:
Creates discount coupons:
Creates taxonomy terms for products:
product_cat) with optional hierarchy (up to 5 levels deep)product_tag)Found a bug or want a feature? Open an issue or submit a pull request.
Requires Node.js v16 and Composer v2+.
npm run setupThis installs dependencies and sets up a pre-commit hook that lints PHP changes using the WooCommerce Core phpcs ruleset.
暂无开放 Issues,或尚未同步最近议题。