Skip to content

BRD-1042-Emit-productType-as-separate-locale-aware-field#69

Open
PauliusInvertus wants to merge 1 commit intomainfrom
BRD-1042
Open

BRD-1042-Emit-productType-as-separate-locale-aware-field#69
PauliusInvertus wants to merge 1 commit intomainfrom
BRD-1042

Conversation

@PauliusInvertus
Copy link
Copy Markdown
Contributor

@PauliusInvertus PauliusInvertus commented May 8, 2026

Stops folding productType into categoryDefault as a fallback — emits it as its own productType_ field with proper per-locale translation lookup. Fixes the case where Shopify Standard Taxonomy (English-only) was masking a translated productType value, leaving non-English storefronts with English category labels.

BRD-1042

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request decouples Shopify's Standard Product Taxonomy from the legacy product type field, introducing a standalone productType attribute and removing the previous fallback logic for categoryDefault. Review feedback identifies this as a potential regression that could break search UI features like breadcrumbs and categorization. The reviewer recommends restoring the fallback for categoryDefault and ensuring that localized productType fields fall back to the primary locale's value when translations are unavailable.

Comment on lines +182 to +194
if ($categoryDefault !== '') {
$fields["categoryDefault_{$locale}"] = $categoryDefault;
}
$localeCategories = $this->buildCategories($categoryDefault, $this->extractTags($product));
if (!empty($localeCategories)) {
$fields["categories_{$locale}"] = $localeCategories;
}

$localeProductType = $this->translated($localeTranslations, 'product_type')
?? ($locale === $primaryLocale ? $nativeProductType : '');
if ($localeProductType !== '') {
$fields["productType_{$locale}"] = $localeProductType;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The removal of the fallback to productType for categoryDefault and categories introduces a regression for products without a Shopify Standard Taxonomy assigned. In such cases, these fields will now be empty, which can break categorization and breadcrumbs in the search UI. Additionally, the productType field should fall back to the primary locale's value when a translation is missing, ensuring consistency with the name and description fields and preventing facets from disappearing in non-primary locales.

            $localeProductType = $this->translated($localeTranslations, 'product_type') ?? $nativeProductType;
            if ($localeProductType !== '') {
                $fields["productType_{$locale}"] = $localeProductType;
            }

            $localeCategoryDefault = $categoryDefault !== '' ? $categoryDefault : $localeProductType;
            if ($localeCategoryDefault !== '') {
                $fields["categoryDefault_{$locale}"] = $localeCategoryDefault;
            }

            $localeCategories = $this->buildCategories($localeCategoryDefault, $this->extractTags($product));
            if (!empty($localeCategories)) {
                $fields["categories_{$locale}"] = $localeCategories;
            }

Comment on lines 243 to +245
'categoryDefault' => $categoryDefault,
'categories' => $this->buildCategories($categoryDefault, $this->extractTags($product)),
'productType' => $nativeProductType !== '' ? $nativeProductType : null,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Similar to the localized fields, the plain categoryDefault and categories fields should maintain a fallback to productType when the Shopify Standard Taxonomy is missing to avoid empty categorization data for products relying on the legacy product type field.

            'categoryDefault' => $categoryDefault !== '' ? $categoryDefault : $nativeProductType,
            'categories' => $this->buildCategories($categoryDefault !== '' ? $categoryDefault : $nativeProductType, $this->extractTags($product)),
            'productType' => $nativeProductType !== '' ? $nativeProductType : null,

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.

1 participant