Skip to content

Release/3.5.0#3293

Closed
tzahgr wants to merge 214 commits intoreleasesfrom
release/3.5.0
Closed

Release/3.5.0#3293
tzahgr wants to merge 214 commits intoreleasesfrom
release/3.5.0

Conversation

@tzahgr
Copy link
Contributor

@tzahgr tzahgr commented Jun 4, 2025

ajello-meta and others added 30 commits February 25, 2025 14:57
Summary:
### Changes proposed in this Pull Request:

This PR introduces a custom checkout permalink to the user's WooCommerce store. **These changes unlock the ability to build and render a checkout based solely on a URL.** Unlike the default `/checkout` path, the checkout permalink is shareable, as there is no redirect involved and the URL persists. The permalink path is `/fb-checkout` and takes in the query parameters `products=` and `coupon=`, which populates the cart accordingly.

Example Permalink: https://www.example.com/fb-checkout?products=12345:2,23456:1&coupon=10off

The Checkout class is added, which handles the creation and management of checkout permalinks. Key functionalities include:

- Rewrite Rule Addition: A new rewrite rule is added to handle URLs with the fb-checkout endpoint, enabling the checkout permalink functionality.
- Query Variables: New query variables (`checkout`, `products`, and `coupon`) are introduced to facilitate the passing of cart data through the URL.
- Cart Management: The cart is cleared and repopulated based on the products query parameter, which specifies product IDs and quantities.
- Coupon Application: A coupon code can be applied to the cart using the coupon query parameter.
- Template Loading: A custom template is loaded to display the checkout permalink page.
- Rewrite Rules Flushing: Rewrite rules are flushed upon plugin activation and deactivation to ensure the new permalink structure is recognized.

### Screenshots:

https://github.com/user-attachments/assets/d200b4eb-1d11-4b4e-9f2a-5f598468e75b

### Detailed test instructions:
1. Test checkout permalink with one product (e.g. `/fb-cart?products=<ID>:<#>)
2. Test checkout permalink with two product (e.g. `/fb-cart?products=<ID>:<#>,<ID2>:<#>)
3. Test checkout permalink with products and a coupon (e.g. `/fb-cart?products=<ID>:<#>,<ID2>:<#>&coupon=<CODE>)

Pull Request resolved: #2887

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/2251800084209441
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/15199648812512803

Reviewed By: carterbuce

Differential Revision: D69648358

Pulled By: ajello-meta

fbshipit-source-id: 9991ae297625e9f55384f7a1560cbafdf8e845cc
Summary:
- Enable code coverage report generation with phpunit (#2893)
- [Cleanup] remove phpcs:ignoreFile annotations preventing code formatting on several smaller files

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

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

### Screenshots:

### Detailed test instructions:

Linting change. Just validate plugin works as expected.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

> Went through project, found several unnecessary occurrences of phpcs:ignore-file and updated file to be compliant with linter

Pull Request resolved: #2897

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/10414574208721470
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V4
https://internalfb.com/intern/testinfra/testrun/7881299600985996

Reviewed By: ajello-meta

Differential Revision: D70136766

Pulled By: sol-loup

fbshipit-source-id: 24448dfe6756256442438c33226d3225fd0964c9
Summary:
### Changelog entry
* Tweak - Removed custom field definitions by devbodaghe in #2876
* Dev - Improved readability of function prepare_product() in fbproduct.php by mshymon in #2889
* Dev - Enabled PHPUnit code coverage report generation by carterbruce in #2893

Pull Request resolved: #2911

Reviewed By: tzahgr

Differential Revision: D70324082

Pulled By: vahidkay-meta

fbshipit-source-id: f7a05f5e5c392162dfcf2956eb8a7fb4381fe28a
Summary:
- Enable code coverage report generation with phpunit (#2893)
- [Cleanup] remove phpcs:ignoreFile annotations preventing code formatting on several smaller files
- Removing unneeded PHPCS-ignore for more files

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

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

### Screenshots:

### Detailed test instructions:

1.
2.
3.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

>

Pull Request resolved: #2901

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/15199648812872431
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/8725724532540319

Reviewed By: carterbuce, ajello-meta

Differential Revision: D70353516

Pulled By: sol-loup

fbshipit-source-id: e58662afe8ac8175a5001e6481d85efdbf0957f5
Summary:
### Changes proposed in this Pull Request:

This PR introduces unit tests for the `Request` and `Response` classes in the `WooCommerce\Facebook\API\ProductCatalog\ProductFeedUploads\Read` namespace. These tests ensure that the classes behave as expected when handling API requests and responses for reading product feed uploads.

### Detailed test instructions:
1. Run the unit tests using the WordPress testing framework to ensure they pass successfully.
2. Verify that the `Request` test checks the HTTP method and path properties.
3. Verify that the `Response` test checks the `data` properties for correct parsing.

Pull Request resolved: #2903

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/14355223882408415
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/9570149278596477

Reviewed By: carterbuce, nrostrow-meta

Differential Revision: D70214585

Pulled By: ajello-meta

fbshipit-source-id: 3f6f923177500e18238f1d8202618c33ae0b6807
Summary:
### Changes proposed in this Pull Request:

This PR introduces unit tests for the `Request` and `Response` classes in the `WooCommerce\Facebook\API\ProductCatalog\ProductFeedUploads\Create` namespace. These tests ensure that the classes behave as expected when handling API requests and responses for creating product feed uploads.

### Detailed test instructions:
1. Run the unit tests using the WordPress testing framework to ensure they pass successfully.
2. Verify that the `Request` test checks the HTTP method, path, and data properties.
3. Verify that the `Response` test checks the `id` and `data` properties for correct parsing.

Pull Request resolved: #2902

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/12666374022148420
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/8162774577600955

Reviewed By: carterbuce, nrostrow-meta

Differential Revision: D70210484

Pulled By: ajello-meta

fbshipit-source-id: 0e9a162726a18083aae7c12a2edf568756a69d40
Summary:
### Changes proposed in this Pull Request:
This PR fixes a bug where templates were not loading correctly. The cause of the issue was in `Checkout.php`, where the rendering of the custom checkout template did not return the $template value if the route was not the custom checkout route.

### Screenshots:
<img width="1724" alt="Screenshot 2025-02-28 at 9 07 35 PM" src="https://github.com/user-attachments/assets/9eccd1a3-53b9-49d3-bc14-340384011df2" />

### Detailed test instructions:
1. Go to http://test-site-i.local/ and ensure page loaded.
3. Go to http://test-site-i.local/fb-checkout/?products=13:2,%2064:1&coupon=10off to make sure custom checkout still works

Pull Request resolved: #2915

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/9570149279137542

Reviewed By: carterbuce

Differential Revision: D70432767

Pulled By: ajello-meta

fbshipit-source-id: 09dba54817ce9e5af9170b714294769989560db4
Summary:
This is a update to notify developers that the facebook-for-woocommerce plugin is now part of Meta and development is taken care by the engineers at Meta. We also have encouraged for contributions on this repo.

### Changes proposed in this Pull Request:

This PR contains mostly the changes around **README.md**.
Since mostly developers of any kind prefer looking at the **README** of a GitHub repo.
We have now changed the README emphasising the changes of the new **Owneship of the plugin** by Meta.
And the invitation for **opensource community** for their contributions.

### Screenshots:

 {F1975511490}

Pull Request resolved: #2910

Reviewed By: mshymon, vinkmeta

Differential Revision: D70323913

Pulled By: SayanPandey

fbshipit-source-id: 3fd9937d20f968132dba4fcc23ebfcabae9a3f55
Summary:
Changing the app word to plugin to more suit with the idea of facebook-for-woocommerce

### Changes proposed in this Pull Request:

This is a simple change of APP to PLUGIN in README.md text .

Pull Request resolved: #2916

Reviewed By: crisojog, vinkmeta

Differential Revision: D70486710

Pulled By: SayanPandey

fbshipit-source-id: 47eb9d84a32712d678e153d5b1a98fbf7074af98
Summary:
### Changes proposed in this Pull Request:

This PR introduces unit tests for the Request and Response classes in the WooCommerce\Facebook\API\ProductCatalog\ItemsBatch\Create namespace. These tests ensure that the classes behave as expected when handling API requests and responses for creating items batches.

- [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.

### Screenshots:
![Screenshot 2025-03-03 at 12 21 33 PM](https://github.com/user-attachments/assets/22bab0d4-50e4-4de7-8d5e-c4692e1ac9a7)

### Detailed test instructions:

1. Run the unit tests with "./vendor/bin/phpunit tests/Unit/Api/ProductCatalog/ItemsBatch/Create" to verify that they pass

Pull Request resolved: #2917

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/5348024825824290
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/1407375288546156

Reviewed By: carterbuce, ajello-meta

Differential Revision: D70511474

Pulled By: nrostrow-meta

fbshipit-source-id: dc57706d284bc8b0ed7a662200d39cd596c97fdb
Summary:
### Changes proposed in this Pull Request:

_implement a dummy logging util, so that teammates can leverage logging function in advance._

- [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.

Pull Request resolved: #2920

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/3096224959402344
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/14355223883410054

Reviewed By: carterbuce

Differential Revision: D70588022

Pulled By: nealweiMeta

fbshipit-source-id: da082b979fb7c0bef639695c46c83dab9b5b7ecd
Summary:
# PR Summary
This PR reverts the addition of explicit property declarations in the AsyncRequest class.

We were seeing lint failures due to accessing an undefined property on the class.

The original code relied on property_exists() checks to determine if child classes had defined custom properties for query arguments, URL, and request arguments.

To fix the lint complaints, these variables were set to "null | undefined" on the class to indicate they were present but unused unless overridden dynamically.

However, explicitly declaring these properties in the parent class, broke this logic since property_exists() now always returns true for these properties, even when they're null.

This change restores the original dynamic property behavior, allowing child classes to optionally define these properties while maintaining the parent class's fallback logic.

### Screenshots:

### Detailed test instructions:

1.
2.
3.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

>

Pull Request resolved: #2921

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/281475381994203
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/15762598767124196

Reviewed By: mradmeta

Differential Revision: D70652138

Pulled By: sol-loup

fbshipit-source-id: 396fadbca8106fbf88cfe1e2764f0cc05dfd7c49
Summary:
### Changes proposed in this Pull Request:
Changes in detail here: https://docs.google.com/document/d/1PaXHKK1PRVtiBEwJtH_8ZP8h0UitDCXZnpFFDWo-eik/edit?tab=t.0#heading=h.m8p14s8600vn
The main idea is to add a FeedManager singleton that will manage all the distinct Feed singletons. The Feed singletons will inherit from an AbstractFeed which will delegate the actual file creation to the Feed Handler or Feed Generator given the admin preferences. With that being said, the sequence will look similar to the existing product flow, but with the above simplifications:

![image](https://github.com/user-attachments/assets/1f0b3929-e4b5-4d37-bd53-6c3792e12a93)

Closes # .
Detailed test instructions:
Added an API test as done in this PR: #2841
Integration test not yet possible as dependent on Mice framework addition and Ent creation
Added comments for how to test/dogfood as well as included instructions in the above linked doc
Successful upload via Feed Handler:
https://www.internalfb.com/intern/cat/sessions/642042718535396/
Successful upload via Feed Generator:
https://www.internalfb.com/intern/cat/sessions/642101398529528/

**See branch common_framework_test to see an example proof of concept that utilizes the base classes.**
This will just include what will be checked in via diff.

Unit Tests
A. Run new tests:
./vendor/bin/phpunit --filter ApiTest
B. Run all tests:
npm run test:php
Manual Tests.
Steps were added via an internal dogfooding doc and requires access to Meta internal tools to validate feed upload sessions status.

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

Pull Request resolved: #2875

Reviewed By: carterbuce, nrostrow-meta

Differential Revision: D69409593

Pulled By: Jmencab

fbshipit-source-id: 8ec2feb7f1ac54d89c9a84f9e6f7ca31592f3f02
Summary:
# Deprecate Facebook Product Fields and Improve UX

## Description
This PR implements a conditional rendering approach for legacy Facebook product fields while deprecating them for new products. This change aims to provide a smoother transition away from deprecated fields while maintaining functionality for existing products that rely on them.

### Changes Made:
- Added conditional rendering for Facebook product fields (Description, Custom Image URL, Facebook Price)
- Fields will only display for products that already have values stored
- Removed these fields from new product creation flow
- Added a dismissible deprecation notice to inform users about the upcoming removal of these fields
- Moved inline styles to dedicated CSS file for better maintainability

### Technical Details:
- Fields are shown only when FB Image URL, Description, Price evaluates true
- Added clear deprecation messaging to help users understand the transition
- Improved code organization by separating presentation logic from business logic

### Testing:
1. Existing products with Facebook fields should:
   - See the deprecation notice
   - Still have access to previously configured fields
   - Be able to edit existing values

2. New products should:
   - Not see the deprecated fields
   - Use the new recommended workflow for Facebook product management

3. All products should maintain their current Facebook catalog sync status

## Screenshots
#### Existing Product Edit Screen
<img width="603" alt="Screenshot 2025-03-06 at 12 13 46" src="https://github.com/user-attachments/assets/fa884306-e448-42f3-8d90-ef36f2277b16" />
*All Facebook fields visible regardless of whether they were being used*

#### New Product Screen

<img width="603" alt="Screenshot 2025-03-06 at 12 13 46" src="https://github.com/user-attachments/assets/837a4681-64c2-46cc-b306-cb296d2a9ac0" />
*Showing all deprecated fields on new product creation*

### After Changes
#### Existing Product with Facebook Fields
<img width="618" alt="Screenshot 2025-03-06 at 12 03 17" src="https://github.com/user-attachments/assets/1ec98723-8db6-4e9e-b1a7-80a83fc3b2ed" />

*Only showing fields that were previously configured, with deprecation notice*

#### New Product Screen

<img width="618" alt="Screenshot 2025-03-06 at 12 03 17" src="https://github.com/user-attachments/assets/3cf9b2fe-f66b-4d16-9f79-1105db0dead2" />

*Clean interface without deprecated fields*

#### Existing Product without Facebook Fields

<img width="603" alt="Screenshot 2025-03-06 at 12 03 46" src="https://github.com/user-attachments/assets/f12ac1d7-f7a9-4fd9-a3c6-3b2ed381e1ff" />

*Similar to new product screen, showing only current supported fields*

Pull Request resolved: #2927

Reviewed By: SayanPandey

Differential Revision: D70699295

Pulled By: devbodaghe

fbshipit-source-id: b2a156978095b8334b9b2772d4e87fe9354dea11
Summary:
# MICE-4 Branch Changes Summary

## Overview
Implements Meta Integrated Commerce Extension (MICE) for Facebook for WooCommerce.

## Key Changes

1. **New MetaExtension Handler** (`includes/Handlers/MetaExtension.php`)
   - REST API endpoints for MICE communication
   - Token management and settings storage
   - iframe URL generation

2. **Enhanced Connection Screen** (`includes/Admin/Settings_Screens/Connection.php`)
   - iframe-based onboarding flow
   - Message handler for iframe communication
   - Event processing for MICE

3. **Unit Tests**
   - `ConnectionTest.php` and `MetaExtensionTest.php`

## Technical Details

- REST endpoints:
  - `/wp-json/wc-facebook/v1/update_fb_settings`
  - `/wp-json/wc-facebook/v1/uninstall`

- Settings stored in WP options with `wc_facebook_` prefix

## How to Enable
The feature is disabled by default. To enable, modify the `use_enhanced_onboarding()` method in `facebook-commerce.php`:

```php
// Line 3029 in facebook-commerce.php
public function use_enhanced_onboarding() {
    return true; // Change from false to true
}
```

## Testing

<img width="1163" alt="Screenshot 2025-02-18 at 4 50 07 PM" src="https://github.com/user-attachments/assets/84e37155-9c11-47c5-ba86-b7ecb2cfcb58" />
<img width="1345" alt="Screenshot 2025-02-06 at 4 39 16 PM" src="https://github.com/user-attachments/assets/2d3c98b9-c1bf-4f8c-984a-dff3fc74c570" />
<img width="1346" alt="Screenshot 2025-02-06 at 4 38 58 PM" src="https://github.com/user-attachments/assets/19727620-35f7-4dd7-8e2e-b549f62e2193" />

### UI Flow
1. WooCommerce marketing icon → Facebook → Connections tab
2. Onboard through MBE
3. Verify MICE management page appears

### Technical Testing
```bash
./vendor/bin/phpunit --filter "ConnectionTest|MetaExtension"
```

### Expected Behavior
- iframe loads and resizes dynamically
- Settings save after connection
- Management interface displays post-connection
- Uninstall clears settings

Pull Request resolved: #2896

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V10
https://internalfb.com/intern/testinfra/testrun/1688850132364698
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V10
https://internalfb.com/intern/testinfra/testrun/1970325108822878

Reviewed By: carterbuce, nrostrow-meta

Differential Revision: D70199367

Pulled By: sol-loup

fbshipit-source-id: c8d852d6d0bcff3b591c0e983af5d61464faeada
Summary:
# Add Unit Tests for AsyncRequest Class
Adds comprehensive unit tests for the AsyncRequest utility class. The tests verify:
- Proper initialization of the class with correct action hooks
- Request data handling via set_data()
- Dispatch functionality with appropriate URL and arguments
- Nonce verification in the request handling flow

The implementation uses PHPUnit's mocking capabilities to intercept WordPress HTTP requests, as it's less straightforward / efficient to record and playback real network calls.

I've verified that the changes originally pushed in #2901  and reverted in #2921 cause these tests to fail.

Closes # .

_Replace this with a good description of your changes & reasoning._

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

### Screenshots:

### Detailed test instructions:

1.
2.
3.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

>

Pull Request resolved: #2922

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/17451448627576264
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/1125900312114451

Reviewed By: carterbuce, jczhuoMeta

Differential Revision: D70733339

Pulled By: sol-loup

fbshipit-source-id: 2fc7f837913cbe021ffa143021900076d80ee030
Summary:
### Changes proposed in this Pull Request:

#### As suggested by vinkmeta, adding since or internal annotations to all functions, and adding minor enhancements to iframe

- Made changes to MetaExtension
- Made changes to Connection to add an id param to iframe (needed for some callbacks)
- Made changes to facebook-commerce use_enhanced_onboarding function

### Detailed test instructions:

1.
2.
3.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

>

Pull Request resolved: #2929

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/8162774579127948
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/5629499803397332

Reviewed By: jczhuoMeta

Differential Revision: D70805552

Pulled By: sol-loup

fbshipit-source-id: 1d946a0596a322c827c667cd51db84fcda319603
Summary:
### Changes proposed in this Pull Request:

Setup cron job for batch logging with global message queue.
I setup the cron job to run every minute just for testing purpose. will change back to five minutes once we push it to prod.

- [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.

Pull Request resolved: #2924

Reviewed By: carterbuce

Differential Revision: D70725001

Pulled By: nealweiMeta

fbshipit-source-id: 867e860ccefe48994834fd781e5e8d6953449c14
)

Summary:
# Revert: Deprecate Legacy Facebook Product Fields for New Products

## Description

This pull request reverts the changes introduced in commit `feat: deprecate legacy Facebook product fields for new products` #2927. The original commit deprecated fb specific fields in product creation.

Pull Request resolved: #2932

Reviewed By: SayanPandey

Differential Revision: D70962783

Pulled By: devbodaghe

fbshipit-source-id: f11622ff1395df5da67db76473ca904877173645
Summary:
In PRs that don't modify any php files, the "Code sniff" and "PHP Unit Tests" checks get stuck in a pending state (ex. #2918). They do not run because the PR doesn't match any of the filters that the workflows define. This causes issues because our repository is set up to require all checks to pass before merging.

This PR updates the filtering on these workflows to run on every PR, regardless of what files were changed.

Pull Request resolved: #2926

Reviewed By: nrostrow-meta

Differential Revision: D70673188

Pulled By: carterbuce

fbshipit-source-id: e2fc616d497e21b9b4f993da365afcc4a0664b4f
Summary:
### Changes proposed in this Pull Request:
MICE currently uses the shop permalink as the shop_domain parameter. This leads us to something like 'domain.com/shop/', which causes issues with generating the checkout url on Meta. The checkout url would be located at 'domain.com/fb-checkout', so this PR updates the shop_domain to use the more root-level site url.

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

### Screenshots:
<img width="635" alt="Screenshot 2025-03-11 at 12 42 16 PM" src="https://github.com/user-attachments/assets/09779e9b-c7c3-485e-a5fc-4ef1243f393b" />

### Changelog entry
- Change MICE shop_domain to use site url instead of shop url

Pull Request resolved: #2934

Reviewed By: ajello-meta, jczhuoMeta

Differential Revision: D70986850

Pulled By: carterbuce

fbshipit-source-id: 578c04c2cf744fe54bfbd780a38c5224725c82cc
Summary:
- phpcs fixes 1 (#2897)
- Release/3.4.1 (#2911)
- Lightly refactoring Admin.php to make it compliant with WooC linter.
- Adding todo for meta_query

### Changes proposed in this Pull Request:

Closes # .

_Replace this with a good description of your changes & reasoning._

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

### Screenshots:

### Detailed test instructions:

1.
2.
3.

### Additional details:

<!--
Optional.
Enter a summary of all changes in this Pull Request, which will be added to the changelog if accepted.
Each line should start with change type prefix`(Fix|Add|…) - `, for example:
> Break - A change breaking previous API or functionality.
> Add - A new feature, function or functionality was added.
> Update - Big changes to something that wasn't broken.
> Fix - Took care of something that wasn't working.
> Tweak - Small change, that isn't actually very important.
> Dev - Developer-facing only change.
> Doc - Updated customer or developer facing documentation

If you remove the "Changelog entry" header, the Pull Request title will be used as the changelog entry.

Add the `changelog: none` label if no changelog entry is needed.
-->
### Changelog entry

>

Pull Request resolved: #2919

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/16888498674860108
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/1970325109499345

Reviewed By: jczhuoMeta

Differential Revision: D70652191

Pulled By: sol-loup

fbshipit-source-id: 9ceb9269a4a458f88569105b82a3aea925844522
Summary:
### Changes proposed in this Pull Request:

Build log to Meta api, and activate error log on top of it.

- [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.

Pull Request resolved: #2933

Test Plan: Scuba logs: https://fburl.com/scuba/commerce_3p_platform_event/83gvotwp

Reviewed By: sol-loup, nrostrow-meta

Differential Revision: D70981675

Pulled By: nealweiMeta

fbshipit-source-id: 0133cfecbf95ac4a639a967bda30f8a8efb39894
Summary:
### Changes proposed in this Pull Request:
This PR introduces an improved UI for the custom checkout permalink of the user's WooCommerce store. These changes renders the custom checkout UI to be exactly the same as the native checkout UI at `/checkout`.

Original template created in #2887.

### Screenshots:
Custom Checkout (Before):
<img width="1724" alt="Screenshot 2025-03-11 at 5 59 44 PM" src="https://github.com/user-attachments/assets/22beb885-b743-4545-9b7f-dac6720be56f" />

Custom Checkout (After):
<img width="1724" alt="Screenshot 2025-03-11 at 5 57 01 PM" src="https://github.com/user-attachments/assets/35203c56-13b9-4c3e-b1bc-df6bd95afd7d" />

Default Checkout:
<img width="1724" alt="Screenshot 2025-03-11 at 5 56 54 PM" src="https://github.com/user-attachments/assets/d44d8071-39b7-4967-bd5f-e5debd7f561b" />

### Detailed test instructions:
1. Test checkout permalink with one product (e.g. `/fb-checkout?products=<ID>:<#>`)
2. Test checkout permalink with two product (e.g. `/fb-checkout?products=<ID>:<#>,<ID>:<#>`)
3. Test checkout permalink with products and a coupon (e.g. `/fb-checkout?products=<ID>:<#>,:<ID>:<#>&coupon=<CODE>`)
4. Test default checkout with products and a coupon (e.g. `/checkout`)

Pull Request resolved: #2930

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/14918173837908345
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/12947849000938296

Reviewed By: carterbuce, nrostrow-meta

Differential Revision: D70997308

Pulled By: ajello-meta

fbshipit-source-id: 24f9bec26bd3492c82e268f8deb518b912cd9794
Summary:
### Changes proposed in this Pull Request:
Our code coverage report currently only runs for files in the `includes` directory. We do have tests, however, for some of the files in the root directory and should be tracking the coverage for those as well.

- [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.

### Screenshots:

<img width="2543" alt="image" src="https://github.com/user-attachments/assets/c57fb69d-ca5a-42e4-9916-389e34e0820a" />

### Detailed test instructions:
vendor/bin/phpunit --coverage-html=reports/coverage

### Changelog entry
Including root directory php files in phpunit code coverage report

>

Pull Request resolved: #2918

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/5066549849138329
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/7036874673521360

Reviewed By: nrostrow-meta

Differential Revision: D70532670

Pulled By: carterbuce

fbshipit-source-id: 02263be263f1f118d983a28b24baa4851d8053dc
Summary:
### Changes proposed in this Pull Request:

Meta sends products to the checkout URL using the Retailer ID format: https://github.com/facebook/facebook-for-woocommerce/blob/33d36f2f6367962aca8a23f610d928c121afcb51/includes/fbutils.php#L188

Our checkout logic currently expects just the numeric product ID to be sent. Since we cannot update the Retailer ID format (it would cause issues for existing installations), this PR updates our checkout URL parsing logic to accept both formats.

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

### Screenshots:
<img width="1462" alt="image" src="https://github.com/user-attachments/assets/0f6f6086-53da-4bbc-9ee4-f328c081f72b" />

### Detailed test instructions:
Steps, where ID is “{product_sku}_{product_id}”:
1. Test checkout permalink with one product (e.g. `/fb-checkout?products=<ID>:<#>)
2. Test checkout permalink with two product (e.g. `/fb-checkout?products=<ID>:<#>,<ID2>:<#>)
3. Test checkout permalink with products and a coupon (e.g. `/fb-checkout?products=<ID>:<#>,<ID2>:<#>&coupon=<CODE>)

### Additional details:

> Add - logging for add to cart failures

### Changelog entry

> Updated to Checkout URL handler to parse Retailer_ID format for product IDs

Pull Request resolved: #2935

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/2814750040395427
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V2
https://internalfb.com/intern/testinfra/testrun/9851624257413970

Reviewed By: ajello-meta

Differential Revision: D71006245

Pulled By: carterbuce

fbshipit-source-id: b103ce8bc7aea9007aad1c430fb3c3ed267da2f3
Summary:
### Changes proposed in this Pull Request:

_Log to local wp-content/debug.log file if debug mode is enabled for debugging purpose._

- [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.

Pull Request resolved: #2939

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/4503599897376193
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/13510798954545736

Reviewed By: carterbuce

Differential Revision: D71061963

Pulled By: nealweiMeta

fbshipit-source-id: 0a622b7dc13f9205702959815c00d538c6976604
Summary:
### Changes proposed in this Pull Request:

This PR builds on #2875 to setup a Ratings and Reviews feed upload in WooCommerce using the feed upload framework.

RatingsAndReviewsFeed, RatingsAndReviewsFeedGenerator, and RatingsAndReviewsFeedHandler are created to handle the feed upload for Ratings and Reviews. FeedManager is updated to include the new Ratings and Reviews feed upload. The feed upload is setup to run once a week. FeedUploadUtils class was created to hold helper functions for the various feed uploads to prevent code duplication.

CsvFeedFileWriter was also updated to use fputcsv so that commas in the content being written to the feed upload file doesn't mess up the parsing/ingestion.

- [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. Once the hourly heartbeat cron job is run you'll find wc_facebook_regenerate_feed_ratings_and_reviews listed as pending in the scheduled actions UI. The action can be triggered to be run whenever you want to kick off the ratings and reviews feed upload.

![Screenshot 2025-03-11 at 3 38 33 PM](https://github.com/user-attachments/assets/51ea07eb-c2bc-4937-8743-425f9ffec3bc)

2. Added some ratings and reviews to the product in my test shop.

![Screenshot 2025-03-11 at 3 37 59 PM](https://github.com/user-attachments/assets/5e0c3fe8-ea40-456b-911e-654fb617b7bb)

3. Modified regenerate_feed locally for RatingsAndReviewsFeed to force the feed handler to be used to run the feed upload. Modified the title set in FeedUploadUtils::get_ratings_and_reviews_data to "Feed Handler Review" so that I could verify that the reviews were synced to Meta using the feed handler.
4. Triggered the ratings and reviews feed upload action to run. Verified that there was a log on the Meta side for the API call, a successful feed upload session created, and that the ratings and reviews data was propagated to the right table.

![Screenshot 2025-03-11 at 3 39 06 PM](https://github.com/user-attachments/assets/bc9914f6-8eee-4208-99ae-683dcd0b9aff)

![Screenshot 2025-03-11 at 3 39 34 PM](https://github.com/user-attachments/assets/55a9bf7d-b1e4-4305-832f-19ee5f59d478)

![Screenshot 2025-03-11 at 3 42 58 PM](https://github.com/user-attachments/assets/da2ac83f-4e4b-45c2-b761-f2ebac7002f7)

5. Modified regenerate_feed locally for RatingsAndReviewsFeed to force the feed generator to be used to run the feed upload. Modified the title set in FeedUploadUtils::get_ratings_and_reviews_data to "Feed Generator Review" so that I could verify that the reviews were synced to Meta using the feed generator.
6. Triggered the ratings and reviews feed upload action to run. Verified that there was a log on the Meta side for the API call, a successful feed upload session created, and that the ratings and reviews data was propagated to the right table.

![Screenshot 2025-03-11 at 3 45 18 PM](https://github.com/user-attachments/assets/fa05b1a6-7ff6-4f39-840a-9b93cf826fd9)

![Screenshot 2025-03-11 at 3 46 30 PM](https://github.com/user-attachments/assets/6a257af6-b08f-42b9-a9dc-34d89365bb2d)

![Screenshot 2025-03-11 at 4 11 24 PM](https://github.com/user-attachments/assets/26689e86-24be-432a-8a98-bd50b6aed1f6)

7. Reverted regenerate_feed and FeedUploadUtils::get_ratings_and_reviews_data to the code found in this PR to manually test the flow without any tweaks.
8. Triggered the ratings and reviews feed upload action to run. Verified that there was a log on the Meta side for the API call, a successful feed upload session created, and that the ratings and reviews data was propagated to the right table.

![Screenshot 2025-03-11 at 4 23 56 PM](https://github.com/user-attachments/assets/1d1806c9-8365-4dea-a126-b535a1890092)

![Screenshot 2025-03-11 at 4 24 49 PM](https://github.com/user-attachments/assets/fa44713b-4d89-4b5e-beeb-c6fc798e53bc)

![Screenshot 2025-03-11 at 4 57 46 PM](https://github.com/user-attachments/assets/bc0e31a1-a9d9-4e98-bf24-7306bafa68b9)

Pull Request resolved: #2937

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/4785074874512106
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/2251800086528751

Reviewed By: carterbuce

Differential Revision: D71008268

Pulled By: nrostrow-meta

fbshipit-source-id: a4b4aaa7a962e73870b94ece22a5b219228454b7
Summary:
### Changes proposed in this Pull Request:
This PR makes the custom checkout UI mobile compatible. The iframe from the latest UI implementation was missing the `<meta name="viewport" content="width=device-width, initial-scale=1">` HTML tag, which caused the mobile UI to not appear for newer devices.

Latest UI created in #2930.

### Screenshots:
Mobile Checkout (Before):
<img width="400" alt="Screenshot 2025-03-13 at 1 10 53 PM" src="https://github.com/user-attachments/assets/bfead0ab-82db-4f0f-81ba-652a03b53ee4" />

Mobile Checkout (After):
<img width="400" alt="Screenshot 2025-03-13 at 1 06 08 PM" src="https://github.com/user-attachments/assets/e279faef-c404-4ee4-a476-38b60e8c782a" />

### Detailed test instructions:
Ensure that you are testing using a mobile device/simulator. You can also test this on the browser by using a mobile aspect ratio.
1. Test checkout permalink with one product (e.g. `/fb-checkout?products=<ID>:<#>`)
2. Test checkout permalink with two product (e.g. `/fb-checkout?products=<ID>:<#>,<ID>:<#>`)
3. Test checkout permalink with products and a coupon (e.g. `/fb-checkout?products=<ID>:<#>,:<ID>:<#>&coupon=<CODE>`)
4. Test default checkout with products and a coupon (e.g. `/checkout`)

Pull Request resolved: #2942

Reviewed By: mradmeta

Differential Revision: D71128822

Pulled By: ajello-meta

fbshipit-source-id: 780627be639effadabda85ac26f6868884836f77
Summary:
# PR: Improve Test Filter Management with AbstractWPUnitTestWithSafeFiltering

This PR addresses a common source of test flakiness by implementing proper WordPress filter management in our test suite.

## The Problem

Sometimes when testing, you want to override the behavior of a global function. This can be done using a wordpress primitive called `add_filter`

While this can be helpful for mocking deep functionality, these filters present a challenge when testing across hundreds of files:

1. **Filter Leakage**: When `add_filter()` is used in tests without proper cleanup, filters persist between tests, causing unexpected behavior and interdependencies.

2. **Incomplete Cleanup**: Manual filter removal is error-prone and often forgotten, especially when tests fail before reaching teardown code.

3. **Overly Aggressive Cleanup**: Using `remove_all_filters()` is dangerous as it removes ALL filters for a hook, including those added by WordPress core or other plugins, potentially breaking functionality in subsequent tests.

## Solution Proposed by this PR

The `AbstractWPUnitTestWithSafeFiltering` class provides:

- A `add_filter_with_safe_teardown()` method that tracks all added filters
- Automatic cleanup in `tearDown()` that only removes filters added by the current test
- The ability to remove specific filters early with `teardown_safely_immediately()`
- A category-specific cleanup method with `teardown_callback_category_safely()` -- allowing you to safely wipe out all test-related filters for 'event_type_A' without affecting B or C.

## Changes

- Introduced AbstractWPUnitTestWithSafeFiltering with above functionality.
- Updated WCFacebookCommerceIntegrationTest, fbproductTest, WPMLTest, and FeedUploadUtilsTest to extend AbstractWPUnitTestWithSafeFiltering
- Replaced all `add_filter()` calls with `add_filter_with_safe_teardown()`
- in some special cases (per-test), replaced remove_all_filters with appropriate teardown calls
- In most cases, rely on default "invisible" safe teardown behavior

## Testing Performed
- Ran updated test suit using phpunit -- all succeeded.

Pull Request resolved: #2944

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/1970325109964811
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V1
https://internalfb.com/intern/testinfra/testrun/3659174967893694

Reviewed By: carterbuce

Differential Revision: D71158932

Pulled By: sol-loup

fbshipit-source-id: 8b3479374bb836dd74a742905226b285da2bfe66
SayanPandey and others added 25 commits May 29, 2025 02:56
Summary:
## Description

Due to recent changes the Woo All Products version will be changed to 3.5.1 from 3.4.12

### Type of change

Please delete options that are not relevant.

Simple text change

## 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)).
- [] 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.
- [] I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this [wiki]([url](https://fburl.com/wiki/nhx73tgs)).

Pull Request resolved: #3265

Test Plan: Upgrade to the latest plugin and observe the banner

Reviewed By: gurtejrehal

Differential Revision: D75595251

Pulled By: SayanPandey

fbshipit-source-id: a0eb3a90511fd2c6b4bd53f4d502b1daab18769c
Summary:
## Description

Moved New Product Sets functionality to Admin

### 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

Moved New Product Sets functionality to Admin

Pull Request resolved: #3243

Test Plan: npm run test:php

Reviewed By: mshymon

Differential Revision: D75409186

Pulled By: vinkmeta

fbshipit-source-id: 54c957b11372267491b64fc4838006ae8961f2b9
Summary:
This reverts commit 5d857bf.

Pull Request resolved: #3267

Reviewed By: mshymon

Differential Revision: D75602967

Pulled By: vinkmeta

fbshipit-source-id: e28dd346c8922ecdd9bd796edaf1d36bfe85bad0
Summary:
Removing the migration of rollout switch to Admin

Pull Request resolved: #3268

Reviewed By: gurtejrehal, francorisso

Differential Revision: D75605068

Pulled By: vinkmeta

fbshipit-source-id: 2d548307572c94202f39d8c5b9c1f219b80deb2e
Summary:
## Description

If the category name contains special characters it is by default comes in the special html format.
For example: "Clothing (v1 & v2)" becomes "Clothing (v1 &amp; v2)".
This PR is a fix to remove the html encoding before string is passed to Meta as a product set name.

### Type of change

Please delete options that are not relevant.

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

## Changelog entry

- Fix to remove html encoding in fb product sets names

Pull Request resolved: #3266

Test Plan:
`npm run test:php`

## Screenshots
Please provide screenshots or snapshots of the system/state both before and after implementing the changes, if appropriate
### Before
<img width="1587" alt="Screenshot 2025-05-29 at 11 06 57" src="https://github.com/user-attachments/assets/f33251a7-5d6f-479c-a7e7-1cbdc12ba352" />

### After
<img width="1576" alt="Screenshot 2025-05-29 at 11 05 34" src="https://github.com/user-attachments/assets/66bf269c-f090-43fb-ad34-5a3c235bc46b" />

Reviewed By: vinkmeta, gurtejrehal

Differential Revision: D75596662

Pulled By: mshymon

fbshipit-source-id: b6e0d51af7b443269b7a679db5409eea2f61ee26
…MBE onboarding flow) (#3270)

Summary:
## Description

There is a Handler class introduced for a new MBE onboarding flow.
When seller onbaords / update catalog ID connection, we should trigger product sets sync.
This PR is adding the trigger just after the products sync.

### Type of change

Please delete options that are not relevant.

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

## Changelog entry

- Trigger product sets sync in Handler on catalog ID update.

Pull Request resolved: #3270

Test Plan: `npm run test:php`

Reviewed By: mradmeta, nrostrow-meta

Differential Revision: D75605968

Pulled By: mshymon

fbshipit-source-id: 34cee2245f875647e5fb10695789565ef7841d7e
Summary:
## Description
This PR fixes phpcs issues in `./facebook-commerce-pixel-event.php`. Comments were also added for several functions. The fixes were made manually (in conjunction with `./vendor/bin/phpcbf`) to ensure that the logic remains the same. Running `./vendor/bin/phpcs`:
```
[FILE: /Users/angeloou/Local Sites/test-site-i/app/public/wp-content/plugins/facebook-for-woocommerce/facebook-commerce-pixel-event.php](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
[FOUND 127 ERRORS AND 12 WARNINGS AFFECTING 135 LINES](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
  13 | ERROR   | [ ] Missing doc comment for class WC_Facebookcommerce_Pixel (Squiz.Commenting.ClassComment.Missing)
  41 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  62 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  65 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  70 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  71 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  73 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  77 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  81 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 [ 82 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
  85 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  86 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  89 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 [ 89 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
  93 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  95 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  96 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
  97 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 108 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
[ 122 | WARNING | [ ] json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
[ 123 | WARNING | [ ] json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
 126 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 134 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 139 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 141 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 147 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 148 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
 156 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
[ 160 | WARNING | [ ] json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
 172 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 180 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 184 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 186 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 192 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 207 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 218 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 221 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 238 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 243 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 258 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 262 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 264 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
 271 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 284 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 285 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 291 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 293 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 295 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 296 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 297 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$this'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
 297 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
 297 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$event_name'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
 297 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$method'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
 298 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 299 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 314 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 326 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 329 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 333 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 335 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
 344 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 358 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 362 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 377 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 383 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 385 | ERROR   | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found 'self'.
     |         |     (WordPress.Security.EscapeOutput.OutputNotEscaped)
 398 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 411 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 414 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 417 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 424 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 428 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 431 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 434 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 436 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
[ 446 | WARNING | [ ] json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
[ 447 | WARNING | [ ] json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
 450 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
[ 461 | WARNING | [ ] json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
 463 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 466 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 480 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 493 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 503 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 516 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 518 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 521 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 526 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 528 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 530 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 533 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 540 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 543 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
[ 544 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
 546 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 550 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 555 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 557 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 559 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 562 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 569 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 572 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
[ 573 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
 575 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 579 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 584 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 586 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 588 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 591 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 598 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 601 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
[ 602 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
 604 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 608 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 613 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 615 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 617 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 620 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 627 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 630 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
[ 631 | WARNING | [x] Loose comparisons are not allowed. Expected: "==="; Found: "==" (Universal.Operators.StrictComparisons.LooseEqual)](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
 633 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 637 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 642 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 645 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 651 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 658 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 663 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 674 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 676 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 677 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 678 | ERROR   | [x] Line indented incorrectly; expected 4 tabs, found 5 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 680 | ERROR   | [x] Line indented incorrectly; expected 4 tabs, found 5 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 681 | ERROR   | [x] Line indented incorrectly; expected 3 tabs, found 4 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 682 | ERROR   | [x] Line indented incorrectly; expected 2 tabs, found 3 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 685 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 692 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 694 | ERROR   | [x] Line indented incorrectly; expected 1 tabs, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
 695 | ERROR   | [x] Line indented incorrectly; expected 0 tabs, found 1 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
[PHPCBF CAN FIX THE 123 MARKED SNIFF VIOLATIONS AUTOMATICALLY](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
[-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------](https://woo2.staging.magento-commerce-extension-testing.com/wp-admin/)
```

### Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected

Pull Request resolved: #3248

Test Plan:
1. Run `./vendor/bin/phpcs`, you should get:
```
FILE: /Users/angeloou/Local Sites/test-site-i/app/public/wp-content/plugins/facebook-for-woocommerce/facebook-commerce-pixel-event.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 127 | WARNING | json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)
 128 | WARNING | json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)
 167 | WARNING | json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)
 461 | WARNING | json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)
 462 | WARNING | json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)
 476 | WARNING | json_encode() is discouraged. Use wp_json_encode() instead. (WordPress.WP.AlternativeFunctions.json_encode_json_encode)
-----------------------------------------------------------------------------------------------------------------------------------------
```
2. Run extension and test the basic functionality to ensure everything still works as intended.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/16044073759114127

Reviewed By: nrostrow-meta

Differential Revision: D75471766

Pulled By: ajello-meta

fbshipit-source-id: 13e469711d1a95bc8817aba764f192a68b867466
…variants (#3269)

Summary:
## Description

This PR fixes critical issues with Facebook product description handling for WooCommerce product variations, ensuring HTML content is properly preserved in rich text descriptions while maintaining plain text for regular descriptions.

### Summary of Changes

**🚨 Critical Fix - Preserve HTML Input in Variation Facebook Fields:**
- **BREAKING BUG**: Product variation Facebook description fields were stripping all HTML content on save
- **ROOT CAUSE**: `save_product_variation_edit_fields()` in `Admin.php` was using `sanitize_text_field()` for both regular and rich text descriptions
- **SOLUTION**: Implemented separate sanitization logic:
  - Regular descriptions: `sanitize_text_field()` (plain text only)
  - Rich text descriptions: `wp_kses_post()` (preserves safe HTML)
- **USER IMPACT**: Users can now enter HTML content (lists, bold, links, etc.) in Facebook description fields for variations and it will be preserved after saving

**Form Display Improvements:**
- Updated variation form to load and display rich text content instead of sanitized plain text
- Updated field description to clarify HTML support: "Supports HTML formatting for rich text display"
- Users now see their HTML content when editing variations instead of stripped text

**Enhanced Rich Text Description Method:**
- Improved `get_rich_text_description()` method in `fbproduct.php` with proper fallback chain
- Added support for variation-specific descriptions with parent inheritance
- Added fallback to short descriptions when main description is empty
- Implemented proper filter application for `facebook_for_woocommerce_fb_rich_text_description`

**Updated Tests:**
- Fixed failing unit tests for rich text description functionality
- All existing tests continue to pass (58/58 tests passing)

### Root Cause
The critical issue was in the variation save method using `sanitize_text_field()` for both regular and rich text descriptions. This function strips ALL HTML tags, meaning users would enter formatted content with HTML (lists, bold text, links) but it would be completely removed upon saving, breaking the rich text functionality that's essential for proper Facebook product presentation.

### Solution
- **Regular Description**: Continue using `sanitize_text_field()` for plain text safety
- **Rich Text Description**: Use `wp_kses_post()` to preserve safe HTML while sanitizing dangerous content
- **Form Display**: Load rich text content instead of plain text for editing experience
- **Method Enhancement**: Improved fallback logic for robust description retrieval

### Type of change
- [x] 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.
- [ ] I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this [wiki]([url](https://fburl.com/wiki/nhx73tgs)).

## Testing
- ✅ All unit tests pass
- ✅ Verified HTML content is preserved in rich text descriptions for variations
- ✅ Verified regular descriptions remain plain text
- ✅ Confirmed form properly displays rich text content after saving
- ✅ Tested variation inheritance and fallback logic
- ✅ Tested HTML input preservation (lists, bold, links, etc.)

## Before/After
**Before:** User enters `<p>Product with <strong>bold</strong> text and <ul><li>Feature 1</li></ul></p>` → Saved as `Product with bold text and Feature 1`
**After:** User enters `<p>Product with <strong>bold</strong> text and <ul><li>Feature 1</li></ul></p>` → Saved as `<p>Product with <strong>bold</strong> text and <ul><li>Feature 1</li></ul></p>`

## Changelog entry

Fixed critical issue where HTML content was being stripped from Facebook rich text descriptions for product variations, ensuring proper formatting is preserved for Facebook product listings.

Pull Request resolved: #3269

Reviewed By: vinkmeta

Differential Revision: D75609962

Pulled By: devbodaghe

fbshipit-source-id: 1b37e774f5b0eb48f062a12bfd7347ead4e9c69c
Summary:
## Description
This PR updates product validation logic in `Checkout.php`. The `WC()->cart->add_to_cart( $product_id, $quantity )` function does not throw an exception when the product ID (or quantity) is invalid. It also does not throw an exception when a product fails to be added to the cart. The updated logic (1) uses `wc_get_product( $product_id )` to retrieve the product and validate it's existence and availability and (2) verifies that `WC()->cart->add_to_cart( $product_id, $quantity )` returns `true`.

### Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Pull Request resolved: #3271

Test Plan:
1. Go to `http://test-site-i.local/fb-checkout?products=<ID>:<#>`. Fill in the "ID" and/or "#" with invalid inputs.
3. Check Meta side logging to ensure that the error logs are visible.

Reviewed By: carterbuce

Differential Revision: D75624861

Pulled By: ajello-meta

fbshipit-source-id: 1c40d1c03f1955e43f203eb19e1b5d32473476d7
Summary:
## Description

Making some methods public static to avoid future breaks/ bugs.

### Type of change

Can be considered minor bug fix

## Checklist

- [] 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.
- [] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc)).
- [] 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]([url](https://fburl.com/wiki/nhx73tgs)).

Pull Request resolved: #3275

Reviewed By: vinkmeta

Differential Revision: D75639897

Pulled By: SayanPandey

fbshipit-source-id: 87c4289b695f1052425d53875f2337226f8d0d8e
Summary:
## Description
In this PR, I added loading state to the Connect, Disconnect, Event Configs creation flow to prevent multiple clicks and to update the end-user on the status of the API call.

### Type of change
- New feature (non-breaking change which adds functionality)

## Changelog entry
Added Loading States to WAUM flows

Pull Request resolved: #3272

Test Plan:
1. Open WhatsApp Utility tab
2. Connect WhatsApp Account by clicking Done in the Onboarding view.
3. Create Event Config by clicking Save in the Manage Event view.
4. Disconnect WhatsApp Account by clicking Disconnect in the confirmation modal.
5. Validate Spinner appears for the clicked button and the buttons are not clickable

## Screen Recording
https://github.com/user-attachments/assets/96381fc1-0d07-47c1-8327-a26b16b92403

Reviewed By: sharunaanandraj

Differential Revision: D75625482

Pulled By: woo-ardsouza

fbshipit-source-id: 043e28ae8639ae85861f2f5581028964d5c763ab
Summary:
## Description
This PR adds logging for coupon codes in `Checkout.php`. The `WC()->cart->apply_coupon( $coupon_code )` function does not throw an exception when the coupon is invalid. The updated logic adds a conditional check that verifies the coupon is correctly applied to the cart, or logs the error if not correctly applied to the cart.

### Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Pull Request resolved: #3279

Test Plan:
1. Go to `http://test-site-i.local/fb-checkout?products=<ID>:<#>&coupon=<code>`. Fill in the "ID" and/or "#" with valid inputs. Fill in "code" with an invalid input.
3. Check Meta side logging to ensure that the error logs are visible for `flow_name=checkout` and `flow_step=apply_coupon` (e.g. https://fburl.com/scuba/commerce_3p_platform_event/91todbpg).

Reviewed By: carterbuce

Differential Revision: D75647174

Pulled By: ajello-meta

fbshipit-source-id: 6ee21d34fe4bbb8860a9c8940fc11fb11016ba15
Summary:
## TL;DR
We found some issue caused by the inconsistency between the legacy and enhanced flow. The real world uses are unlikely to have the same serious issues. This PR put out a graceful fix it them.

## Description
During dogfooding and QA testing, we get reports of:
1. Should show legacy view but rendered with BROKEN MiCE page
2. Used the enhanced flow onboard but seeing the legacy view after onboarding.

The causes has been identified as:
1. The CPI ID didn't get cleared out when off boarding using legacy flow.
This has been fixed in https://github.com/facebook/facebook-for-woocommerce/pull/3262/files but for existing instances off boarded before the fix landed, it's still experience problems
2. Some fields(e.g. business id) were missed during saving the onboarding result, causing MiCE failed to render.

### Issue 1
It's mainly impacting QA and internal users, for public users, the only chance they have a stale CPI ID and seeing this issue only if the performed the exact actions:
1. They upgraded to 3.4.8, the CPI was repaired in the background.
2. They disconnected their shop, staled CPI stay in their DB
3. They reconnected their shop
4. They upgraded 3.5.0, staled CPI causing their MiCE rendering to be all broken

However, since this will cause broken MiCE page, this PR introduces graceful and robust logic to ensure the CPI is correct:
a. Using MBE response as source of truth, if the response from Meta does not have CPI ID, then clear the local CPI ID. This ensures no stale CPI ID.
b. The CPI repair endpoint will fetch or repair, get the correct CPI ID
The logic is implemented in refresh_installation_data heartbeat will fix the data inconsistency automatically.

### Issue 2
It wasn't surfaced frequently as the refresh_installation_data is also repairing the missing IDs in the background. This PR added the saving action of those missing fields.

### 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

Fix onboarding and offboarding data inconsistency between legacy and enhanced connection view.

Pull Request resolved: #3285

Test Plan:
No unit test can cover it since it's caused by a sequence of actions.
All existing tests passes:

Time: 00:28.917, Memory: 121.00 MB
OK (324 tests, 859 assertions)

### Manual test it to cover all the cases.
#### Before
Verify on 3.5.0 branch, the business manager id was missing:
<img width="1004" alt="image" src="https://github.com/user-attachments/assets/3f153d93-8d01-415e-bd15-ffef00ef7230" />

The cpi id exists:
<img width="807" alt="image" src="https://github.com/user-attachments/assets/6b2abf18-bf61-4151-9168-2a97593bd6c6" />
and should be cleaned during uninstall since current 3.5.0 already included the cleanup fix(https://github.com/facebook/facebook-for-woocommerce/pull/3262/files), however, still manually make a copy so we can verify a lingering cpi_id won't break things.

#### After
Disconnect and switch to the current branch:
After onboarding, we now have business ID populated:
<img width="955" alt="image" src="https://github.com/user-attachments/assets/c9e16e73-1334-4e12-a50d-4249e70a9a96" />

Now use the wrong CPI id to make sure the installation can recover:
1. Use the previously saved, 2153153801813487 to overwrite wc_facebook_commerce_partner_integration_id, 729123966146427, intentionally put a stall cpi_id in the field.
<img width="799" alt="image" src="https://github.com/user-attachments/assets/3a511552-7513-452f-a53f-0c0a43cda2b1" />

6. Go to Meta side and manually delete the correct CPI 729123966146427
The Overview page broken as expected, mimicking the staled CPI ID cases
<img width="944" alt="image" src="https://github.com/user-attachments/assets/a4c507df-e0bb-417b-941b-1817545b7c44" />

7. Run update_installation_data
<img width="575" alt="image" src="https://github.com/user-attachments/assets/2efe2ec6-e313-4d2b-85d6-9dd1f4fc2905" />
<img width="780" alt="image" src="https://github.com/user-attachments/assets/8f7bfd4b-d7d1-4be4-926a-47bdca6aadd2" />
This removed staled CPI ID

<img width="952" alt="image" src="https://github.com/user-attachments/assets/3a43875d-4bfc-4a8b-a5d3-0afba7df7173" />
The legacy view is showing as expected

8. Run repair to create a new CPI
<img width="655" alt="image" src="https://github.com/user-attachments/assets/7b8f9809-4276-4a5d-8af9-554dd9dfda3c" />
<img width="936" alt="image" src="https://github.com/user-attachments/assets/85ec3fff-f260-443f-9377-19ba5b8584c9" />
Now the MiCE is rendering poperly

Reviewed By: carterbuce, nrostrow-meta

Differential Revision: D75704293

Pulled By: jczhuoMeta

fbshipit-source-id: c35608e45d47d261d14cad3b8daf495330eca321
(cherry picked from commit 17c63e4)
Summary:
## Description

A new tag is failing to be ingested in the backend and therefore removing it form feeds and sync.

### Type of change

Code change

## 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.
- [] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc)).
- [] 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)).

Pull Request resolved: #3287

Reviewed By: vinkmeta

Differential Revision: D75795279

Pulled By: SayanPandey

fbshipit-source-id: cd7dc17c4d87dc52398ab160e0cb29b38661901f
(cherry picked from commit b50a934)
#3292)

Summary:
## Description

We got an report from QA of an error log being surfaced due to this non-static method being called in a static way. This is similar to some other errors we've seen and fixed recently. Updating the method to be static to resolve the error.

https://privatebin.net/?7272b8875ee5971f#9fkC642u6APEjm6TQsYoD6jLrW1MEvrkGQDvwUaQJuYZ

### Type of change

Please delete options that are not relevant.

- 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]([url](https://fburl.com/wiki/2cgfduwc)).
- [] 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]([url](https://fburl.com/wiki/nhx73tgs)).

## Changelog entry

Fix non-static method reset_upcoming_version_banners called by WP Hook

Pull Request resolved: #3292

Reviewed By: nrostrow-meta

Differential Revision: D75900200

Pulled By: carterbuce

fbshipit-source-id: 1abe21f61d1916feceaf9181577f9ce049d41a01
(cherry picked from commit 3160c53)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.