Skip to content

Fix for the gap in Purchase events through CAPI#3060

Closed
vahidkay-meta wants to merge 3 commits intomainfrom
fix/purchase_event_gap
Closed

Fix for the gap in Purchase events through CAPI#3060
vahidkay-meta wants to merge 3 commits intomainfrom
fix/purchase_event_gap

Conversation

@vahidkay-meta
Copy link
Copy Markdown
Contributor

Added a hook to woocommerce_new_order event to ensure we track Purchase events through different flows. Also added a flag to the order metadata to track whether a Purchase event has been sent for this order or not. Added more hooks to track if an event's status changed from on-hold or pending to processing or completed through the WP dashboard. Also fixed a phpcs warning in AAMSettings.php file

Description

This PR is addressing the gap in Purchase events being sent by this plugin compared to GTM & Stape.
The details are explained in this doc: https://fburl.com/gdoc/ihoi9jna

Type of change

Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have commented my code, particularly in hard-to-understand areas.
  • I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
  • I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
  • I followed general Pull Request best practices. Meta employees to follow this wiki.
  • I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
  • I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
  • I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this wiki.

Changelog entry

Fixed a problem where Purchase event was not firing if thankyou page was not shown or Purchase state updated through Woo dashboard

Test Plan

On a woo website, use any of the following payment options and check the Purchase event being registered:

  • Klarna
  • Card Payment
  • Direct Bank transfer
  • Cash on delivery
  • Paypal

…se events through different flows. Also added a flag to the order metadata to track whether a Purchase event has been sent for this order or not. Added more hooks to track if an event's status changed from on-hold or pending to processing or completed through the WP dashboard. Also fixed a phpcs warning in AAMSettings.php file
@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 Apr 15, 2025
Comment thread facebook-commerce-events-tracker.php Outdated
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@vahidkay-meta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@vahidkay-meta merged this pull request in 21f2866.

carterbuce pushed a commit to carterbuce/facebook-for-woocommerce that referenced this pull request Apr 24, 2025
Summary:
Added a hook to woocommerce_new_order event to ensure we track Purchase events through different flows. Also added a flag to the order metadata to track whether a Purchase event has been sent for this order or not. Added more hooks to track if an event's status changed from on-hold or pending to processing or completed through the WP dashboard. Also fixed a phpcs warning in AAMSettings.php file

## Description

This PR is addressing the gap in Purchase events being sent by this plugin compared to GTM & Stape.
The details are explained in this doc: https://fburl.com/gdoc/ihoi9jna

### Type of change
Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have commented my code, particularly in hard-to-understand areas.
- [x] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [x] I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc)).
- [x] I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
- [x] I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
- [x] I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this [wiki]([url](https://fburl.com/wiki/nhx73tgs)).

## Changelog entry

Fixed a problem where Purchase event was not firing if thankyou page was not shown, Custom payment provider or order management plugin used, or Purchase state updated through Woo dashboard

Pull Request resolved: facebook#3060

Test Plan:
On a woo website, use any of the following payment options and check the Purchase event being registered:

- Klarna
- Card Payment
- Direct Bank transfer
- Cash on delivery
- Paypal

Reviewed By: tzahgr

Differential Revision: D73507420

Pulled By: vahidkay-meta

fbshipit-source-id: e879f24103ca0b4505fa981b99d820de9181ee77
(cherry picked from commit 21f2866)
carterbuce pushed a commit to carterbuce/facebook-for-woocommerce that referenced this pull request Apr 24, 2025
Summary:
Added a hook to woocommerce_new_order event to ensure we track Purchase events through different flows. Also added a flag to the order metadata to track whether a Purchase event has been sent for this order or not. Added more hooks to track if an event's status changed from on-hold or pending to processing or completed through the WP dashboard. Also fixed a phpcs warning in AAMSettings.php file

## Description

This PR is addressing the gap in Purchase events being sent by this plugin compared to GTM & Stape.
The details are explained in this doc: https://fburl.com/gdoc/ihoi9jna

### Type of change
Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have commented my code, particularly in hard-to-understand areas.
- [x] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [x] I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc)).
- [x] I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
- [x] I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
- [x] I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this [wiki]([url](https://fburl.com/wiki/nhx73tgs)).

## Changelog entry

Fixed a problem where Purchase event was not firing if thankyou page was not shown, Custom payment provider or order management plugin used, or Purchase state updated through Woo dashboard

Pull Request resolved: facebook#3060

Test Plan:
On a woo website, use any of the following payment options and check the Purchase event being registered:

- Klarna
- Card Payment
- Direct Bank transfer
- Cash on delivery
- Paypal

Reviewed By: tzahgr

Differential Revision: D73507420

Pulled By: vahidkay-meta

fbshipit-source-id: e879f24103ca0b4505fa981b99d820de9181ee77
(cherry picked from commit 21f2866)
@carterbuce carterbuce mentioned this pull request Apr 24, 2025
tzahgr pushed a commit that referenced this pull request Apr 24, 2025
Summary:
Added a hook to woocommerce_new_order event to ensure we track Purchase events through different flows. Also added a flag to the order metadata to track whether a Purchase event has been sent for this order or not. Added more hooks to track if an event's status changed from on-hold or pending to processing or completed through the WP dashboard. Also fixed a phpcs warning in AAMSettings.php file

## Description

This PR is addressing the gap in Purchase events being sent by this plugin compared to GTM & Stape.
The details are explained in this doc: https://fburl.com/gdoc/ihoi9jna

### Type of change
Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have commented my code, particularly in hard-to-understand areas.
- [x] I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
- [x] I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc)).
- [x] I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
- [x] I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
- [x] I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this [wiki]([url](https://fburl.com/wiki/nhx73tgs)).

## Changelog entry

Fixed a problem where Purchase event was not firing if thankyou page was not shown, Custom payment provider or order management plugin used, or Purchase state updated through Woo dashboard

Pull Request resolved: #3060

Test Plan:
On a woo website, use any of the following payment options and check the Purchase event being registered:

- Klarna
- Card Payment
- Direct Bank transfer
- Cash on delivery
- Paypal

Reviewed By: tzahgr

Differential Revision: D73507420

Pulled By: vahidkay-meta

fbshipit-source-id: e879f24103ca0b4505fa981b99d820de9181ee77
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. CLA Signed Merged type: bug The issue is a confirmed bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants