Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix item price in purchase event #2184

Merged

Conversation

jorgemd24
Copy link
Contributor

@jorgemd24 jorgemd24 commented Dec 15, 2023

Changes proposed in this Pull Request:

Closes #2181 .

The purchase event on the Order confirmation page was displaying the wrong price for each item. Instead of showing the individual item's price, it was reflecting the total amount for that line.

For example, if we have an item priced at 3€ and we purchase 2 units:

Before:

image

After:

image

Detailed test instructions:

  1. Open an incognito window.
  2. Purchase a product and add more than 1 unit to the cart.
  3. Finish the order.
  4. Use the Google Analytics debugger extension, GA4 Debug View, or inspect the code on the Order confirmation page.
  5. Check that the purchase event -> items -> price aligns with the product price.

Additional details:

@mikkamp suggested that a nice way to test these scenarios by including wp_print_inline_script_tag into the WP Proxy class, enabling us to test various outcomes. I'll create a follow-up issue to focus on this.

Changelog entry

Fix - item price in purchase event.

@jorgemd24 jorgemd24 self-assigned this Dec 15, 2023
@github-actions github-actions bot added changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug. labels Dec 15, 2023
Copy link

codecov bot commented Dec 15, 2023

Codecov Report

Merging #2184 (d65b577) into develop (2b9b5ae) will not change coverage.
Report is 51 commits behind head on develop.
The diff coverage is 62.5%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             develop   #2184   +/-   ##
=========================================
  Coverage       58.2%   58.2%           
  Complexity      4127    4127           
=========================================
  Files            453     453           
  Lines          17691   17691           
=========================================
  Hits           10300   10300           
  Misses          7391    7391           
Flag Coverage Δ
php-unit-tests 58.2% <62.5%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/DB/Table.php 9.1% <ø> (ø)
src/DB/TableInterface.php 0.0% <ø> (ø)
src/Infrastructure/GoogleListingsAndAdsPlugin.php 0.0% <ø> (ø)
src/Shipping/ZoneMethodsParser.php 98.4% <100.0%> (ø)
google-listings-and-ads.php 6.2% <0.0%> (ø)
src/DB/Migration/Migration20231109T1653383133.php 0.0% <0.0%> (ø)
src/Google/GlobalSiteTag.php 0.0% <0.0%> (ø)

Copy link
Contributor

@puntope puntope left a comment

Choose a reason for hiding this comment

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

Thx @jorgemd24 LGTM

I tested adding 4 units and it showed only the price per unit.

Screenshot 2023-12-15 at 16 06 31

Also, I tested with decimals as I saw there was a round param in that new function.

Screenshot 2023-12-15 at 16 12 11

@jorgemd24 jorgemd24 merged commit a9cfff3 into develop Dec 18, 2023
14 checks passed
@jorgemd24 jorgemd24 deleted the fix/2181-item-price-is-incorrect-in-purchase-event branch December 18, 2023 19:41
@puntope puntope mentioned this pull request Dec 18, 2023
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

item price is incorrect in purchase event
2 participants