Multi-currency support for CAPI events #3659
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds multi-currency support to Facebook Pixel event tracking, ensuring that Purchase and Subscribe events are sent to Meta with the actual
transaction currency instead of the store's default currency. This is critical for WooCommerce stores using multi-currency plugins (e.g., WOOCS, WPML,
Aelia Currency Switcher) to ensure accurate conversion tracking and reporting in Facebook Ads Manager.
Changes made:
Context:
Previously, all events were sent with the store's base currency regardless of the actual currency used in the transaction. This caused:
Type of change
Checklist
Changelog entry
Add multi-currency support for Purchase and Subscribe events, ensuring accurate currency tracking for stores using multi-currency plugins
Test Plan
Prerequisites
Test Steps
Test 1: Purchase Event with Non-Default Currency
- Correct currency (EUR, not USD)
- Correct value in the transaction currency
Test 2: Subscribe Event with Multi-Currency
Test 3: Filter Hook Customization
add_filter('facebook_for_woocommerce_event_currency', function($currency, $event_name, $order) {
error_log("Event: $event_name, Currency: $currency");
return $currency;
}, 10, 3);
Test 4: Backward Compatibility
Expected Results