Skip to content

Conversation

@nikmclaughlin
Copy link

@nikmclaughlin nikmclaughlin commented Nov 28, 2025

All Submissions:

Changes proposed in this Pull Request:

Adds a generator class and CLI command for generating customer product reviews.

The generator expects products and customers to already exist. It inserts each new review comment on a random existing product and assigns it to a random existing user.

I included an array of ~50 fake review snippets to use as seed data. Using review-like text helped for my purposes, but could be substituted for something from Faker or just generic lorem ipsum if that's preferred. The existing text is also English-only, which may or may not be ideal.

Lastly, it may also be nice to add a flag to trigger review generation during product generation, but that's left for a future enhancement here.

How to test the changes in this Pull Request:

  1. Check out the CLI doc, make sure it looks right: wp help wc generate reviews
  2. On a site with customers and products, try generating some product reviews, and check the work in the WC Admin UI:
    wp wc generate reviews
    wp wc generate reviews 25
  3. Try the same on a fresh site with no products or no customers and see that generation fails gracefully

Other information:

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

Changelog entry

Add a new generator for product reviews.

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