fix(product): randomize tax_class on generated products - #215
Open
faisalahammad wants to merge 1 commit into
Open
fix(product): randomize tax_class on generated products#215faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
- Use wc_get_product_tax_class_options() to get available tax classes - Randomly pick a tax class instead of always defaulting to Standard - Applied to simple, variable, and variation product generation Fixes woocommerce#178
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.
Currently
tax_classis hardcoded to''(Standard) in the product generator, so all generated products always get the Standard tax class regardless of what tax classes are configured in the store.This change uses
wc_get_product_tax_class_options()to get all available tax class slugs (Standard + any custom/reduced-rate classes), then picks one at random via Faker — the same pattern already used fortax_statusand other randomized fields.Changes:
generate_simple_product()— randomizetax_classgenerate_variable_product()— randomizetax_classfor parent productgenerate_variable_product()— randomizetax_classfor each variationFixes #178