Skip to content

Address review feedback for brand feature (PR #174)#201

Open
layoutd wants to merge 15 commits intotrunkfrom
fix/pr-174-review-feedback
Open

Address review feedback for brand feature (PR #174)#201
layoutd wants to merge 15 commits intotrunkfrom
fix/pr-174-review-feedback

Conversation

@layoutd
Copy link
Contributor

@layoutd layoutd commented Feb 13, 2026

Changes proposed in this Pull Request:

Addresses review feedback from PR #174 to improve the brand generation feature:

  • Assign brands using wp_set_object_terms() instead of invalid brand_ids property
  • Support 1-3 brands per product (variable number like categories/tags)
  • Some PHPCS linter fixes to pass CI

How to test:

  1. Generate products with brands: wp wc generate products 20
  2. Verify brands are created at /wp-admin/edit-tags.php?taxonomy=product_brand&post_type=product
  3. Check products have 1-3 brands assigned
  4. Run tests: vendor/bin/phpunit --testsuite unit

Testing:

  • All 103 tests pass (243 assertions)
  • No infinite loops when generating brands
  • Coding standards compliance verified with phpcs

Related to #174

masteradhoc and others added 8 commits August 25, 2025 20:16
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Use company() for brand names instead of deviceManufacturer() (more unique values)
- Use wp_set_object_terms() for brand assignment (1-3 brands per product)
- Remove brand_ids from product props (not supported by WC core)
- Add brand cache clearing in batch()
- Generate brand terms in maybe_generate_terms()
- Fix spacing and coding standards per phpcs

company() provides hundreds of unique company names vs deviceManufacturer()'s 6 values,
avoiding duplicate term issues entirely without needing retry limits.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Smooth Generator’s brand-support work from PR #174 by improving brand term generation and assigning brands to generated products using WordPress taxonomy relationships.

Changes:

  • Generate product_brand term names using Faker’s company() (intended to increase uniqueness).
  • Assign 1–3 brand terms per generated product via wp_set_object_terms() and generate missing brand terms in maybe_generate_terms().
  • Apply PHPCS/PHPCBF-driven formatting and coding standards fixes across the touched generators.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
includes/Generator/Term.php Adjusts term name generation logic, including a special-case for product_brand, plus formatting fixes.
includes/Generator/Product.php Assigns 1–3 brand terms to generated products, generates missing brand terms, and clears brand term cache between batches.
includes/Generator/Generator.php Adds an additional Faker provider (Bezhanov\\Faker\\Provider\\Device) during initialization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants