Skip to content

Conversation

@dongfueled
Copy link

@dongfueled dongfueled commented Jan 30, 2026

Summary by CodeRabbit

  • New Features
    • Purchase tracking now includes discount amounts in analytics data, improving visibility into order totals and promotional impact.
    • Reports and integrations that consume purchase events will reflect discounts, helping with revenue attribution and marketing analysis.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 30, 2026

Walkthrough

A "discount" field was added to the Facebook Pixel Purchase payload returned by format(), set to Number(checkoutData.discountsAmount?.amount ?? 0) when present or 0 otherwise.

Changes

Cohort / File(s) Summary
Facebook Pixel Purchase Payload
shopify/purchase_custom_pixel.js
Added discount numeric field to the object returned by format(), sourced from checkoutData.discountsAmount.amount with a 0 fallback.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • aklishchevskiy
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a discount field to the purchase event payload.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch FUEL-1756

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@shopify/purchase_custom_pixel.js`:
- Line 62: The discount field may end up as a string; coerce it to a numeric
type when building the payload by wrapping the entire expression in Number with
a safe fallback, e.g. replace discount: checkoutData.discountsAmount?.amount ??
0 with discount: Number(checkoutData.discountsAmount?.amount ?? 0) so the
discount value is always a Number (consistent with value which is already cast).

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.

3 participants