Skip to content

FIX keep the variation attribute value when a custom attribute shadows a taxonomy - #20

Open
Pichinov-Jose wants to merge 1 commit into
SplashSync:masterfrom
Pichinov-Jose:fix/variant-attribute-value-fallback
Open

Pichinov-Jose wants to merge 1 commit into
SplashSync:masterfrom
Pichinov-Jose:fix/variant-attribute-value-fallback

Conversation

@Pichinov-Jose

Copy link
Copy Markdown

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 $attribute comes back null. $attributeName is 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

…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>
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.

Variation attribute value silently lost when a custom attribute shares its name with a taxonomy

1 participant