Skip to content

Add coupons customers generation to Settings page - #213

Open
masteradhoc wants to merge 4 commits into
woocommerce:trunkfrom
masteradhoc:settings-coupons-customers-generation
Open

Add coupons customers generation to Settings page#213
masteradhoc wants to merge 4 commits into
woocommerce:trunkfrom
masteradhoc:settings-coupons-customers-generation

Conversation

@masteradhoc

Copy link
Copy Markdown
Contributor

All Submissions:


Changes proposed in this Pull Request:

Customers and coupons can currently only be generated via WP-CLI (wc generate customers / wc generate coupons). This PR exposes both generators in the admin UI, on par with products and orders.

Changes are limited to includes/Admin/Settings.php:

  • Added DEFAULT_NUM_CUSTOMERS and DEFAULT_NUM_COUPONS constants (default: 10)
  • Added "Generate customers" and "Generate coupons" form sections to the settings page
  • Added the corresponding process_page_submit() branches that call BatchProcessor::create_new_job()

No other files required changes — Router.php and BatchProcessor.php already supported both slugs. The date-range Advanced Options are intentionally not passed to customers/coupons, as neither generator uses them.

Closes # .


How to test the changes in this Pull Request:

  1. Navigate to Tools → Smooth Generator in wp-admin.
  2. Verify "Generate customers" and "Generate coupons" sections appear with a number input and a Generate button each.
  3. Enter a number, click Generate, and confirm the progress bar runs and the correct number of customers/coupons is created in WooCommerce.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Expose customer and coupon generation in the admin UI. Both generators were previously available via WP-CLI only; they can now be triggered directly from the Smooth Generator settings page.


FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant