Skip to content

fix(braze-42): honor replaceSkuWithProductName on recommended eCommerce path#733

Open
nickolas-dimitrakas wants to merge 1 commit into
feat/braze-42-recommended-ecommercefrom
fix/braze-42-sku-replacement-flag
Open

fix(braze-42): honor replaceSkuWithProductName on recommended eCommerce path#733
nickolas-dimitrakas wants to merge 1 commit into
feat/braze-42-recommended-ecommercefrom
fix/braze-42-sku-replacement-flag

Conversation

@nickolas-dimitrakas

Copy link
Copy Markdown

Summary

Follow-up to #728 addressing Cursor Bugbot's "SKU replacement flag ignored" finding.

  • Recommended eCommerce forwarding (useEcommerceRecommendedEvents) always used product.sku as productId, while legacy logPurchase honors replaceSkuWithProductName. The same commerce event could therefore identify products differently in Braze depending on which forwarding path ran.
  • Adds recommendedProductId(), mirroring the legacy flag check, and uses it everywhere the recommended path emits a product identifier: line items (recommendedLineItems), ProductViewedEvent, and the order_refunded JSON payload (recommendedProductsJson).
  • Also removes a redundant explicit it -> lambda label in logEvent flagged in review.

Stacked on #728 — this branch is based on feat/braze-42-recommended-ecommerce and should be retargeted to workstation/6.0-Release once #728 merges.

Test plan

  • RecommendedEcommerceTests — added coverage for the flag on the cart/line-item, product-detail, and refund paths (12/12 tests pass)
  • ktlintCheck passes on the kit

…ce path

Recommended eCommerce forwarding (useEcommerceRecommendedEvents) always used
product.sku as productId, while legacy logPurchase honors the
replaceSkuWithProductName setting. The same commerce event could therefore
identify products differently in Braze depending on which forwarding path
ran. Add recommendedProductId(), mirroring the legacy flag check, and use it
everywhere the recommended path emits a product identifier (line items,
ProductViewedEvent, and the order_refunded JSON payload).

Also removes a redundant explicit `it ->` lambda label in logEvent flagged
during PR #728 review.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nickolas-dimitrakas
nickolas-dimitrakas requested a review from a team as a code owner July 16, 2026 17:43
@cursor

cursor Bot commented Jul 16, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Behavior change is gated on an existing kit setting and only affects recommended eCommerce product identifiers; tests cover the new paths.

Overview
When useEcommerceRecommendedEvents is on, Braze recommended events always used product.sku as productId, while legacy logPurchase can send the product name if replaceSkuWithProductName is True. The same commerce event could therefore identify products differently in Braze depending on which path ran.

This PR adds recommendedProductId() (same flag check and error fallback as legacy) and routes all recommended product_id emissions through it: ProductViewedEvent, cart/checkout/order line items, and the ecommerce.order_refunded products JSON. RecommendedEcommerceTests cover the flag on product detail, add-to-cart line items, and refund payloads. Two redundant it -> labels in logEvent are removed.

Reviewed by Cursor Bugbot for commit 8e1f40b. Bugbot is set up for automated code reviews on this repo. Configure here.

@sonarqubecloud

Copy link
Copy Markdown

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