FIX keep the variation attribute value when a custom attribute shadows a taxonomy - #20
Open
Pichinov-Jose wants to merge 1 commit into
Open
Pichinov-Jose wants to merge 1 commit into
Pichinov-Jose wants to merge 1 commit into
Conversation
…s a taxonomy When a variation carries a custom attribute (attribute_xxx) while a taxonomy of the same name (pa_xxx) exists, getValueByCode() looks the value up in the taxonomy, finds nothing, and the name comes back empty. The variation is then exported with no value at all, and targets that require one reject the whole product. Fall back on the raw value the variation actually holds. Closes SplashSync#11 Co-Authored-By: Claude Opus 5 <noreply@anthropic.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.
Bug
When a variation carries a custom attribute (
attribute_xxx) while a taxonomy of the same name (pa_xxx) also exists,Manager::getValueByCode($code, $name)resolves the value against the taxonomy, finds nothing, and$attributecomes back null.$attributeNameis then"".The variation is exported with an empty attribute value. Nothing is logged — the field simply carries nothing. Targets that require a value on a variant attribute reject the whole product, and the operator sees a validation failure with no clue that the value was lost on the way out.
This is easy to hit: WooCommerce lets a shop create a global attribute and a per-product one with the same label, and the two never meet.
Fix
When the group resolves but the value does not, fall back on the raw value the variation actually holds — which is the correct answer in that situation.
Closes #11. Running in production on a WooCommerce 11.1.0 shop.
🤖 Generated with Claude Code