Address review feedback for brand feature (PR #174)#201
Open
Address review feedback for brand feature (PR #174)#201
Conversation
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.
Contributor
There was a problem hiding this comment.
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_brandterm names using Faker’scompany()(intended to increase uniqueness). - Assign 1–3 brand terms per generated product via
wp_set_object_terms()and generate missing brand terms inmaybe_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.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this Pull Request:
Addresses review feedback from PR #174 to improve the brand generation feature:
wp_set_object_terms()instead of invalidbrand_idspropertyHow to test:
wp wc generate products 20/wp-admin/edit-tags.php?taxonomy=product_brand&post_type=productvendor/bin/phpunit --testsuite unitTesting:
Related to #174