Skip to content

Fix duplicate InitiateCheckout when using checkout block.#2349

Merged
rawdreeg merged 1 commit intodevelopfrom
fix/duplicate-InitiateCheckout-event-checkout-block
Nov 7, 2022
Merged

Fix duplicate InitiateCheckout when using checkout block.#2349
rawdreeg merged 1 commit intodevelopfrom
fix/duplicate-InitiateCheckout-event-checkout-block

Conversation

@rawdreeg
Copy link
Copy Markdown
Contributor

@rawdreeg rawdreeg commented Nov 1, 2022

Changes proposed in this Pull Request:

When using checkout WC Block, initiateCheckout event is triggered on the order received page. This causes an incomplete event to be sent to Facebook causing a warning. This PR adds an additional check to confirm the cart is not empty.

Closes #2348 .

  • [ x] Do the changed files pass phpcs checks? Please remove phpcs:ignore comments in changed files and fix any issues, or delete if not practical.

Detailed test instructions:

  1. Ensure checkout form uses Checkout WC Block
  2. Add product to cart and navigate to checkout. Using the Facebook Pixel Helper chrome extension, confirm the initiateCheckout event is properly triggered.
  3. Confirm the initiateCheckout event is not triggered a second time on the order received page

Additional details:

I came across this issue while investigating #2075.

Changelog entry

Fix - duplicate InitiateCheckout when using checkout block.

@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 Nov 1, 2022
@rawdreeg rawdreeg requested a review from a team November 1, 2022 11:52
@rawdreeg rawdreeg self-assigned this Nov 1, 2022
@message-dimke
Copy link
Copy Markdown
Contributor

Any tip on how to reproduce the issue?

Checkout_–_WordPress-Facebook_and_Duplicate_InitiateCheckout_when_using_checkout_block__·_Issue__2348_·_woocommerce_facebook-for-woocommerce

This is on develop branch, no InitiateCheckout at Order Received page.

@rawdreeg
Copy link
Copy Markdown
Contributor Author

rawdreeg commented Nov 7, 2022

Any tip on how to reproduce the issue?

Hey @message-dimke, this seems to occur when the WC Checkout block is used. I made a video reproducing the issue:

Screen.Recording.Duplicate.InitCheckout.mov

Copy link
Copy Markdown
Contributor

@message-dimke message-dimke left a comment

Choose a reason for hiding this comment

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

Seems good, thanks @rawdreeg !

@rawdreeg rawdreeg merged commit 0018668 into develop Nov 7, 2022
@rawdreeg rawdreeg deleted the fix/duplicate-InitiateCheckout-event-checkout-block branch November 7, 2022 18:22
@ibndawood ibndawood mentioned this pull request Nov 15, 2022
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.

Duplicate InitiateCheckout when using checkout block.

2 participants