Skip to content

Release/3.4.5#3000

Merged
tzahgr merged 11 commits intoreleasesfrom
release/3.4.5
Apr 3, 2025
Merged

Release/3.4.5#3000
tzahgr merged 11 commits intoreleasesfrom
release/3.4.5

Conversation

@tzahgr
Copy link
Copy Markdown
Contributor

@tzahgr tzahgr commented Apr 2, 2025

mshymon and others added 8 commits April 1, 2025 11:44
…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
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
@github-actions github-actions Bot added the changelog: none Skip changelog entry for this PR label Apr 2, 2025
tzahgr and others added 3 commits April 2, 2025 15:32
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
@tzahgr tzahgr requested review from iodic and vahidkay-meta April 3, 2025 10:53
Comment thread includes/Admin.php

// Only add badge if it hasn't been added yet
if (!syncedBadgeState[key]) {
$field.after('<span class="sync-indicator wc-attributes-icon" data-tip="Synced from the Attributes tab."><span class="sync-tooltip">Synced from the Attributes tab.</span></span>');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we add translations for these strings?

@tzahgr tzahgr merged commit 650e954 into releases Apr 3, 2025
7 checks passed
@tzahgr tzahgr deleted the release/3.4.5 branch April 3, 2025 14:02
Comment thread package.json
"@wordpress/env": "^9.10.0",
"@wordpress/scripts": "^14.0.0"
"@wordpress/scripts": "^14.0.0",
"jest": "^29.7.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Who has added all these changes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: none Skip changelog entry for this PR CLA Signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants