Skip to content

Merge Release 3.4.5 to main#3006

Open
tzahgr wants to merge 39 commits intomainfrom
release/3.4.5
Open

Merge Release 3.4.5 to main#3006
tzahgr wants to merge 39 commits intomainfrom
release/3.4.5

Conversation

@tzahgr
Copy link
Copy Markdown
Contributor

@tzahgr tzahgr commented Apr 3, 2025

vahidkay-meta and others added 30 commits February 27, 2025 15:21
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
Add - Items batch request and response tests by @nrostrow-meta in #2917
Tweak - Always run PHP-based github workflows by @carterbuce in #2926
Fix - feed upload error "feed_column_count_mismatch" when product has multiple colors separated by a comma by @mshymon in #2947
Tweak - Updated Pull Request Template by @vinkmeta in #2948
Tweak - Enabled PHPUnit code coverage report generation by @carterbuce in #2893
Dev - Improved readability of function prepare_product() in fbproduct.php by @mshymon in #2889
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 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:
- 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:
- 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:
Changing the app word to plugin to more suit with the idea of facebook-for-woocommerce

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

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.

 {F1975511490}

Pull Request resolved: #2910

Reviewed By: mshymon, vinkmeta

Differential Revision: D70323913

Pulled By: SayanPandey

fbshipit-source-id: 3fd9937d20f968132dba4fcc23ebfcabae9a3f55
Summary:
## Description

Adding is_multisite logging for additional context on seller setup during FBE plugin version update log. This will help us determine how to focus our compatibility efforts

### Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Test instructions

Called `facebook_for_woocommerce()->get_api()->update_plugin_version_configuration( 'carter-wp-dev-67381a66bf371', '9.9.1' );` and observed proper log format was sent to Meta

## Checklist

- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added tests 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.

## Changelog entry

Added is_multisite logging to the update_plugin_version_configuration request

Pull Request resolved: #2955

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: www / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/13229323979124907
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V3
https://internalfb.com/intern/testinfra/testrun/9007199329033893

Reviewed By: vinkmeta

Differential Revision: D71495474

Pulled By: carterbuce

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

This PR changes the API response to include the actual product retailer ID set in WooCommerce. This will later be used to generate the checkout URL.

### Type of change

- [ x ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Screenshots
Please provide screenshots or snapshots of the system/state both before and after implementing the changes, if appropriate

N/A - backend change

## Test instructions

./vendor/bin/phpunit --filter fbproductTest

## Checklist

- [ x ] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added tests 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.

## Changelog entry

Add woo_commerce_retailer_id to products API request

Pull Request resolved: #2958

Reviewed By: vinkmeta

Differential Revision: D71630166

Pulled By: crisojog

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

Currently, the plugin version is sent to Meta APIs once after each plugin upgrade. However, due to the current reliability issues with the APIs, many of these values are being lost, making it difficult to determine which plugin version is being used for a given connection. Therefore, we will now send the plugin version once daily.

### Type of change

Please delete options that are not relevant.

- [x] Bug fix (non-breaking change which fixes an issue)
- [] New feature (non-breaking change which adds functionality)
- [] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Screenshots
N/A

## Test instructions

npm run test:php

Following relevant tests are updated
/tests/Unit/ExternalVersionUpdate/UpdateTest.php

## Checklist

- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added tests 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.

## Changelog entry

> Syncing plugin version info

Pull Request resolved: #2960

Reviewed By: devbodaghe, gurtejrehal

Differential Revision: D71704465

Pulled By: vinkmeta

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

Currently items out of stock are not synced if the user has selected a setting in inventory to hide the products that are out of stock from the catalog. We want to synced them anyways.

### Type of change

Please delete options that are not relevant.

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

## Screenshots

After clicking SYNC PRODUCTS in the plugin config:

### Before

<img width="1329" alt="Screenshot 2025-03-18 at 17 29 39" src="https://github.com/user-attachments/assets/5c3c3ed4-727b-48d0-9196-4a3bb8e47c34" />

### After

<img width="1345" alt="Screenshot 2025-03-18 at 10 19 25" src="https://github.com/user-attachments/assets/919c398d-2daf-49f0-96a6-57eb2e2ba913" />

## Test instructions

npm run test:php  ran was successful

## Checklist

- [ ] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added tests 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.

## Changelog entry

sync products out of stock to meta despite visibility config

Pull Request resolved: #2952

Reviewed By: vinkmeta

Differential Revision: D71408859

Pulled By: francorisso

fbshipit-source-id: 3de82ba398910edc7790fbceb90f75a183b7f301
Summary:
## Description

This PR changes the API response to include the actual product retailer ID set in WooCommerce. This will later be used to generate the checkout URL. After Marian's comment on the previous PR we're changing to use the existing field external_variant_id

### Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Screenshots
N/A

## Test instructions

./vendor/bin/phpunit --filter fbproductTest

## Checklist

- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added tests 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.

## Changelog entry

Update woo_commerce_retailer_id to existing field external_variant_id

Pull Request resolved: #2963

Reviewed By: vinkmeta

Differential Revision: D71741355

Pulled By: crisojog

fbshipit-source-id: 00789cd414f1b9610f427b5294b5b16fcce200d1
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:

Remove duplicate changelog entries from the readme.txt file and reference the actual changelog.txt file instead.
Going forward, the readme.txt should only be updated during minor or major version upgrades, eliminating the need to update duplicate changelog entries here.

Modified core plugin files

- [ ] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added tests 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.

Update readme.txt

Pull Request resolved: #2949

Differential Revision: D71287086

Pulled By: vinkmeta

fbshipit-source-id: ccee3f89ce15454f1504b40d3bbe401cfd94c094
…latency (#2973)

Summary:
## Description

In this PR I am adding a new product field to be passed to Meta side, which is `external_update_time` - a timestamp of when the woo product was last updated. We intend to use this field to measure a latency of when products get updated on the Meta side.

### Type of change

- [x] New feature (non-breaking change which adds functionality)

## Screenshots
N/A

## Test instructions

* Automated testing
    * Run all unit tests: `npm run test:php`
* Manual testing
    * In WooCommerce UI I updated one product and checked that Batch API request contains the new field and the timestamp value is correct.
    * Also triggered a feed upload and verified the new field is present in the feed file and the value is as expected

## Checklist

- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added tests and all the new and existing unit tests pass locally with my changes
- [x] I have completed dogfooding, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
    - A stand alone QA testing is not required, will be part of plugin release QA.

## Changelog entry

One liner entry to be surfaced in changelog.txt

Pull Request resolved: #2973

Reviewed By: gurtejrehal

Differential Revision: D71965438

Pulled By: mshymon

fbshipit-source-id: 80479cc83a8c7edab67e47c66c5c599ee0331168
Summary:
## Description

There is an issue raised in the WordPress forum (https://wordpress.org/support/topic/undefined-variable-fb_product_parent-in-webroot-wp-content-plugins-facebook-fo/) about PHP warning in debug log:

`PHP Warning:  Undefined variable $fb_product_parent in /bitnami/wordpress/wp-content/plugins/facebook-for-woocommerce/includes/fbproductfeed.php on line 335`.

This PR fixing the issue.

### Type of change

Please delete options that are not relevant.

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

## Screenshots

### Before
Logs contains the PHP Warning after I trigger feed file generation.
<img width="2857" alt="Screenshot 2025-03-27 at 15 47 42" src="https://github.com/user-attachments/assets/b626ab60-4bc4-4901-8106-67f38000d4a4" />

### After
Logs do not contains the PHP Warning after I trigger feed file generation.
<img width="2859" alt="Screenshot 2025-03-27 at 15 49 44" src="https://github.com/user-attachments/assets/3f9aaa74-72ed-4d6b-9e89-c854cc0a0c58" />

## Test instructions
Manually trigger feed file generation (WooCommerce => Status => Scheduled Actions => wc_facebook_regenerate_feed) and monitor debug logs via "WP Console" tool.

## Checklist

- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added tests 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.

## Changelog entry

Fix for 'PHP Warning:  Undefined variable $fb_product_parent'

Pull Request resolved: #2976

Reviewed By: devbodaghe

Differential Revision: D71979661

Pulled By: mshymon

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

Problem. We selecting a product feed for creating one-time feed upload sessions to sync products, we are prioritising to choose an existing product feed created by MBE onboarding.  The problem is that in production some of the catalogs have that default feed already in use for creating and updating products (from some 3rd party sources).  In those cases, by uploading new one-time feed upload sessions, we are deleting all products previously ingested by the feed (as 3rd party source are almost for sure have different population of product Retailer IDs).

Fix. We should avoid choosing the default MBE created feed and just choose/create the unique Facebook for WooCommerce plugin feed.

### Type of change

Please delete options that are not relevant.

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

## Screenshots
See below in the test plan.

Pull Request resolved: #2989

Test Plan:
Manual testing on my catalog.
Before start, I have two feeds, including the default MBE feed, which was used by earlier logic:
<img width="1975" alt="Screenshot 2025-03-31 at 19 20 47" src="https://github.com/user-attachments/assets/d4af0d82-a34f-465d-ab6d-c3ddbc604eae" />

I manually triggered feed file generation, which then selects a feed and start the one-time upload session. The new feed was created and chosen.
<img width="1936" alt="Screenshot 2025-03-31 at 19 24 08" src="https://github.com/user-attachments/assets/7e3158d5-e34f-42fb-aaa5-dd3476a45e26" />
Have this reflected in the WooCommerce facebook log file:

<img width="2479" alt="Screenshot 2025-03-31 at 19 23 22" src="https://github.com/user-attachments/assets/65766d31-d9cd-4673-8ff5-cc12a3b75835" />

When triggered feed file generation again, the same feed (2096188910809232) was chosen.

## Checklist

- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added tests 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.

## Changelog entry

Fix - Updated logic to choose/create the feed for product sync

Reviewed By: vinkmeta

Differential Revision: D72183913

Pulled By: mshymon

fbshipit-source-id: 36d7a528ee370f10c5e135bf4e7cf64c218bfe45
David Evbodaghe and others added 8 commits April 1, 2025 14:37
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:
# 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:

This PR enhances the Facebook for WooCommerce plugin's handling of simple & variant products and their synchronization with Facebook's catalog system. The changes improve data consistency, simple & variant attribute management, and catalog integration.

- Enhanced product variant data preparation and synchronization
    - Fixed incorrect variant attribute mapping to Facebook catalog
    - Resolved missing variant data during sync operations
    - Corrected variant relationship hierarchy
    - Fixed attribute inheritance from parent products
    - Implemented proper validation for variant-specific attributes
    - Fixed synchronization timing issues between parent and child products
    - Fixed attribute format mismatches between WooCommerce and Facebook- Improved handling of enhanced catalog fields
    - Enhanced meta data synchronization logic

- Enhanced simple product data preparation and ad optimization
    - Fixed metadata attribute mapping to Facebook catalog fields
    - Implemented comprehensive product attribute synchronization
    - Added support for extended catalog attributes
    - Improved validation for product-specific attributes
    - Standardized attribute format between platforms
    - Added support for enhanced catalog fields
        - Brand attribute mapping
        - Material property support
        - Pattern recognition
        - Color specification
        - Size standardization
        - Age group targeting
        - Gender classification
        - Condition status

1. **Variant Attribute Management**
   - Added validation for variant attributes
   - Improved filtering of Commerce attributes
   - Enhanced attribute name sanitization

2. **Simple Product Management**
   - Streamlined attribute synchronization for non-variable products
   - Enhanced catalog field mapping for simple products
   - Improved handling of single product meta data
   - Added validation for standalone product attributes
   - Optimized direct-to-catalog synchronization flow
   - Implemented robust error checking

- Executed `npm run test:php` with new test coverage for:
  - Variant attribute synchronization
  - Simple product metadata handling
  - Enhanced catalog field mapping
  - Product relationship hierarchy
  - Data format validation
  - Error handling scenarios

- Executed `npm run test:js` with coverage for:
  - Sync indicator visibility
  - Sync status icon display
  - Tooltip functionality
  - Sync badge state tracking
  - WooCommerce to Meta sync status validation

1. Simple Products
   - Create new simple product in WooCommerce
   - Add enhanced catalog attributes
   - Configure metadata fields
   - Verify successful sync to Meta catalog
   - Confirm all attributes appear correctly
   - Validate product data in Meta Ads Manager

2. Variable Products
   - Create new variable product
   - Set up multiple variations with attributes
   - Configure parent-child relationship
   - Add variation-specific metadata
   - Verify sync to Meta catalog
   - Confirm variant hierarchy
   - Validate attribute inheritance
   - Check variation display in Meta Ads Manager

- [ ] Create new simple product
- [ ] Create new variable product with multiple variations
- [ ] Add all enhanced catalog fields
- [ ] Configure custom attributes
- [ ] Verify sync status in WooCommerce
- [ ] Check product appearance in Meta catalog
- [ ] Validate product data in Meta Ads Manager
- [ ] Verify attribute mapping accuracy
- [ ] Test product updates and resync
- [ ] Confirm error handling and notifications

This comprehensive overhaul of the Facebook for WooCommerce plugin significantly improves product data synchronization, fixing critical issues where variant attributes weren't properly syncing to Meta's catalog. The update ensures complete data transfer for both simple and variant products, properly handling parent-child relationships and timing synchronization issues that previously caused incomplete or incorrect product representations.

The enhancement introduces robust UI improvements with visual sync status indicators and tooltips, backed by automated UI testing to ensure reliable feedback to users. This visual confirmation system, combined with standardized attribute format matching between WooCommerce and Facebook platforms, provides users with confidence that their product data is accurately synchronized.

The update expands metadata coverage and catalog field support, implementing comprehensive attribute mapping that directly improves product discoverability and ad targeting capabilities. By ensuring all available product attributes are properly synchronized, businesses can now leverage their complete product data for more effective Meta advertising campaigns.

These improvements are validated through extensive testing, including PHP backend tests, automated UI verification, and thorough integration testing for both simple and variant products. The result is a more reliable, efficient, and user-friendly product management experience that maximizes marketing potential through accurate and complete product data synchronization with Meta's platforms.

Pull Request resolved: #2938

Reviewed By: vinkmeta

Differential Revision: D71045123

Pulled By: devbodaghe

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

Fixed PHP Warning for empty attributes when selected Google product Category doesn't have any associated attributes. In such cases simply returning the products data without enhancing it.

### Type of change

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

## Checklist

- [x] I followed general Pull Request best practices. Meta employees to follow this [wiki]([url](https://fburl.com/wiki/2cgfduwc))
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have added tests 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.

## Changelog entry

Fixed PHP Warning for empty attributes

Pull Request resolved: #3001

Test Plan: npm run test:php

Reviewed By: raymon1, mshymon, SayanPandey

Differential Revision: D72318247

Pulled By: vinkmeta

fbshipit-source-id: 81f6396cc350083643cb887ca2b4f0bec8cc6d55
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.

8 participants