Skip to content

Adding support for FB Product Level Video sync#2874

Closed
gurtejrehal wants to merge 19 commits intofacebook:mainfrom
gurtejrehal:garry
Closed

Adding support for FB Product Level Video sync#2874
gurtejrehal wants to merge 19 commits intofacebook:mainfrom
gurtejrehal:garry

Conversation

@gurtejrehal
Copy link
Copy Markdown
Contributor

@gurtejrehal gurtejrehal commented Feb 7, 2025

Changes proposed in this Pull Request:

This PR introduces new functionality to add support for the video syncing capabilities for WooCommerce products, allowing users to select and sync videos directly using the WooCommerce Media Library.

Existing Functionality

  • Video Syncing: Previously, only videos present in the Long or Short description fields were synced using the batch API.

Reason: Natively due to current design, users can't add video to WC Product Gallery(requires 3p plugin support)

New Functionality

image
  • Video Selection for Syncing: Users can now select specific videos to sync for their products.
  • Integration using WooCommerce Media Library: By reusing the WooCommerce Media Library, users can easily select or upload video files. This integration ensures video validation, guaranteeing that the correct video URLs are always obtained.

Flow

WC.FB.Video.Flow.mov
  • 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. Run all tests : npm run test:php
image
  1. Lint: ./vendor/bin/phpcs
  2. Run new test ./vendor/bin/phpunit --filter test_prepare_product_videos
  3. E2E Tests
    • Single Product Update

      • Go to individual product. Upload a video using FB product video form field.
      • Click Publish->Update
      • Outcome : Video Synced to facebook
    • Batch API Update

      • Disconnect from facebook
      • Connect back and create a new catalog
      • Products are synced with batch API flow
      • Outcomes : New catalog created on facebook, with Videos synced at product level.

Additional details:

  • This update is backward compatible and does not affect existing video syncing functionality.

Changelog entry

  • Add FB product video field to add videos.
  • Added products sync to support the video field with Batch API.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@gurtejrehal has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@gurtejrehal has updated the pull request. You must reimport the pull request before landing.

2 similar comments
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@gurtejrehal has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@gurtejrehal has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

gurtejrehal and others added 18 commits February 17, 2025 11:54
Summary:

Bumping up the version number to 3.3.4

Pull Request resolved: facebook#2881

Reviewed By: akpurifb

Differential Revision: D69455861

Pulled By: vahidkay-meta

fbshipit-source-id: ec3e9282e3ff5a383dabc564eabfdbba71005666
Summary:

This PR introduces a new feature to the Facebook WooCommerce Plugin, allowing users to add rich text descriptions to their products. With this update, we can seamlessly synchronize the rich text description field with the Facebook Commerce Manager platform.

It also adds functionality for a WYSIWYG input box for the Facebook Description field in the plugin

- Updated the product sync logic to handle rich text formatting.
- Modified the API payload to include the rich text description field.
- Tested for compatibility with common formatting options (bold, italic, lists, links, etc.).

- Improves the visual appeal of product descriptions on Meta.
- Ensures consistent branding and formatting across platforms.
- Enhances user engagement by presenting more structured and detailed product information.

1. Enable the WooCommerce to Meta product sync.
2. Create or edit a product in WooCommerce with a rich text description (e.g., headings, bold, italic, lists).
3. Sync the product and verify that the description appears correctly formatted on Meta.

<img width="1244" alt="Screenshot 2024-11-04 at 11 21 23" src="https://github.com/user-attachments/assets/eb1c1fbb-5734-4c27-b710-1e031f1a58e6">
<img width="601" alt="Screenshot 2024-11-04 at 11 22 26" src="https://github.com/user-attachments/assets/a40f84e8-3127-4b62-a87d-c172ab257a98">
<img width="753" alt="Screenshot 2024-11-04 at 11 22 41" src="https://github.com/user-attachments/assets/75063389-5a78-4ae2-a73f-c2a392427472">
<img width="740" alt="Screenshot 2024-12-24 at 18 24 52" src="https://github.com/user-attachments/assets/e011e53e-9892-4e06-ace1-bfd7e22dab22" />

 ---

Please let me know if there are any edge cases or scenarios that should be tested further.

Pull Request resolved: facebook#2843

Reviewed By: vinkmeta

Differential Revision: D69199179

Pulled By: devbodaghe

fbshipit-source-id: 8d620efa52fe16c9c936dc8ad4136689d273dc8c
Summary:

This PR introduces a new feature to the Facebook WooCommerce Plugin, allowing users to add rich text descriptions to their products. With this update, we can seamlessly synchronize the rich text description field with the Facebook Commerce Manager platform.

It also adds functionality for a WYSIWYG input box for the Facebook Description field in the plugin

- Updated the product sync logic to handle rich text formatting.
- Modified the API payload to include the rich text description field.
- Tested for compatibility with common formatting options (bold, italic, lists, links, etc.).

- Improves the visual appeal of product descriptions on Meta.
- Ensures consistent branding and formatting across platforms.
- Enhances user engagement by presenting more structured and detailed product information.

1. Enable the WooCommerce to Meta product sync.
2. Create or edit a product in WooCommerce with a rich text description (e.g., headings, bold, italic, lists).
3. Sync the product and verify that the description appears correctly formatted on Meta.

<img width="1244" alt="Screenshot 2024-11-04 at 11 21 23" src="https://github.com/user-attachments/assets/eb1c1fbb-5734-4c27-b710-1e031f1a58e6">
<img width="601" alt="Screenshot 2024-11-04 at 11 22 26" src="https://github.com/user-attachments/assets/a40f84e8-3127-4b62-a87d-c172ab257a98">
<img width="753" alt="Screenshot 2024-11-04 at 11 22 41" src="https://github.com/user-attachments/assets/75063389-5a78-4ae2-a73f-c2a392427472">
<img width="740" alt="Screenshot 2024-12-24 at 18 24 52" src="https://github.com/user-attachments/assets/e011e53e-9892-4e06-ace1-bfd7e22dab22" />

 ---

Please let me know if there are any edge cases or scenarios that should be tested further.

Pull Request resolved: facebook#2843

Reviewed By: vinkmeta

Differential Revision: D69199179

Pulled By: devbodaghe

fbshipit-source-id: 8d620efa52fe16c9c936dc8ad4136689d273dc8c
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@gurtejrehal has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@gurtejrehal has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@gurtejrehal merged this pull request in 2ead32a.

@gurtejrehal gurtejrehal deleted the garry branch February 17, 2025 14:36
iodic pushed a commit that referenced this pull request Feb 18, 2025
Summary:
### Changes proposed in this Pull Request:
This PR introduces new functionality to add support for the video syncing capabilities for WooCommerce products, allowing users to select and sync videos directly using the WooCommerce Media Library.

### Existing Functionality
 - **Video Syncing**: Previously, only videos present in the Long or Short description fields were synced using the batch API.
> Reason: Natively due to current design, users can't add video to WC Product Gallery(requires 3p plugin support)

### New Functionality
<img width="859" alt="image" src="https://github.com/user-attachments/assets/47040390-b2f5-4fba-8f0b-23c2a8dba160" />

- **Video Selection for Syncing**: Users can now select specific videos to sync for their products.
- **Integration using WooCommerce Media Library**: By reusing the WooCommerce Media Library, users can easily select or upload video files. This integration ensures video validation, guaranteeing that the correct video URLs are always obtained.

----

### Flow

https://github.com/user-attachments/assets/85745ee9-5f42-4c31-9bc4-da65a7e368f3

- [ ] 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. Run all tests : `npm run test:php`
<img width="578" alt="image" src="https://github.com/user-attachments/assets/74e6b20e-9522-42b3-881f-7abb2301d268" />

2. Lint: `./vendor/bin/phpcs`
3. Run new test `./vendor/bin/phpunit --filter test_prepare_product_videos`
4. **E2E Tests**
   - Single Product Update
       * Go to individual product. Upload a video using FB product video form field.
       * Click Publish->Update
       * Outcome : Video Synced to facebook

   - Batch API Update
      * Disconnect from facebook
      * Connect back and create a new catalog
      * Products are synced with batch API flow
      * Outcomes : New catalog created on facebook, with Videos synced at product level.

### Additional details:
 - This update is backward compatible and does not affect existing video syncing functionality.

<!--
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
 - Add FB product video field to add videos.
 - Added products sync to support the video field with Batch API.

Pull Request resolved: #2874

Reviewed By: vinkmeta

Differential Revision: D69311498

Pulled By: gurtejrehal

fbshipit-source-id: 5c8aec55556908de6f9cfec4d44063d0d1bccdc8
facebook-github-bot pushed a commit that referenced this pull request Feb 18, 2025
Summary:
### Changes proposed in this Pull Request:

This test is related to #2874 to verify the functionality of the video_field setting.
In other words, this test ensures that setting a video_field to an empty value is equivalent to not setting it at all, and that no additional steps are needed to reset or clear the field.

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

### Flow
When setting a video field, the following steps are performed:
 - **Convert Attachment IDs to Video URLs**: The provided attachment_ids are converted into corresponding video_urls.
 - **Create a Video Array**: The converted video_urls are then stored in an array.
 - **Save the Video Array**: The resulting video array is saved as the new value for the video_field.

### Detailed test instructions:
1. ./vendor/bin/phpunit --filter test_set_product_video_urls
<img width="521" alt="image" src="https://github.com/user-attachments/assets/b83eef07-c42d-4898-9d55-c17a9635b9ba" />

2. npm run test:php

Pull Request resolved: #2888

Reviewed By: devbodaghe

Differential Revision: D69778534

fbshipit-source-id: 0c0e5b4c941ef5fa02a3eb943e36ed5ddd371a58
facebook-github-bot pushed a commit that referenced this pull request Feb 25, 2025
Summary:
## Changelog:

* Add - FB product video field to add videos. Also added products sync to support the video field with Batch API by gurtejrehal in #2874
* Tweak - tests for #2874 by gurtejrehal in #2888
* Tweak - tests for Product Update action as ramp up task by nealweiMeta in #2883
* Fix - translations loading before the init hook by iodic in #2866
* Fix - Fixed feeds by requesting a feed file upload session after feed file is generated and added missing new fields to the feed file by mshymon in #2841

Pull Request resolved: #2891

Reviewed By: akpurifb

Differential Revision: D69836863

Pulled By: vahidkay-meta

fbshipit-source-id: 32408ab4b42f60f921bd599ed982933017185b5e
facebook-github-bot pushed a commit that referenced this pull request Jun 5, 2025
Summary:
## Description
Earlier, we introduced video sync at simple product level in #2874.

This PR brings enabling the video sync at variable product level.

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

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

 - enable video sync at variable product level.

Pull Request resolved: #3291

Test Plan:
1. Run all tests : `npm run test:php`
<img width="541" alt="image" src="https://github.com/user-attachments/assets/8456d111-9f7b-4e6a-9575-bf7ac5ff3b09" />

2. Lint: `./vendor/bin/phpcs`
3. Run test `./vendor/bin/phpunit --filter test_prepare_product_videos`
4. **E2E Tests**
   - Single Product Update
       * Go to individual product. Upload a video using FB product video form field.
       * Click Publish->Update
       * Outcome : Video Synced to facebook

   - Batch API Update
      * Disconnect from facebook
      * Connect back and create a new catalog
      * Products are synced with batch API flow
      * Outcomes : New catalog created on facebook, with Videos synced at product level.

### test
| **video sync simple product**  | **video sync variable product** |
| -------- | ------- |
| https://pxl.cl/7nr6V | https://pxl.cl/7nrB1  |

## Screenshots
| **Before** | **After**|
| -------- | ------- |
| <img width="2256" alt="Screenshot 2025-06-03 at 16 52 14" src="https://github.com/user-attachments/assets/3ab146f7-40cd-4a6c-9109-bf7ac9322336" /> | <img width="2256" alt="Screenshot 2025-06-03 at 16 50 02" src="https://github.com/user-attachments/assets/7c608cc0-4f4a-4773-8f9b-3bb6af550d70" /> |

Reviewed By: SayanPandey

Differential Revision: D75878114

Pulled By: gurtejrehal

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

3 participants