Fix product variation fields not saving correctly#3090
Closed
devbodaghe wants to merge 3 commits intofacebook:mainfrom
Closed
Fix product variation fields not saving correctly#3090devbodaghe wants to merge 3 commits intofacebook:mainfrom
devbodaghe wants to merge 3 commits intofacebook:mainfrom
Conversation
Contributor
|
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Contributor
|
@devbodaghe merged this pull request in 80b9ecf. |
tzahgr
pushed a commit
that referenced
this pull request
Apr 28, 2025
Summary: # Fix Product Variation Fields Not Saving Correctly ## Description This PR fixes an issue where product variation custom fields for Facebook for WooCommerce were not being properly saved and displayed. Specifically, the MPN (Manufacturer Part Number) and custom image URL values weren't being preserved when saving product variations. The issue was caused by two main problems: 1. The MPN field was being incorrectly formatted as a decimal number with `wc_format_decimal()` when rendered, which is inappropriate for an alphanumeric identifier 2. The custom image URL was potentially being overwritten due to variable reuse in the save logic These bugs prevented merchants from properly configuring their product variations for Facebook Catalog sync. ### 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](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](https://fburl.com/wiki/nhx73tgs). ## Changelog entry Fix issue where product variation MPN and custom image URL fields weren't being properly saved and displayed. Pull Request resolved: #3090 Test Plan: 1. Create a variable product with at least one variation 2. Enable Facebook sync for the variation 3. Set a custom MPN value (e.g., "ABC12345") and a custom image URL 4. Save the product 5. Reload the product edit page 6. Verify that the MPN and custom image URL values have been preserved ## Screenshots ### Before https://pxl.cl/74Rzv When saving product variations, the MPN field and custom image URL would not persist after saving. ### After https://pxl.cl/74Rzk The MPN field and custom image URL now correctly display and save the values entered by users. Reviewed By: carterbuce Differential Revision: D73611087 Privacy Context Container: L1313315 Pulled By: devbodaghe fbshipit-source-id: 5308dfb808e63055d033b3da847fde32d0b62885
devbodaghe
pushed a commit
to devbodaghe/facebook-for-woocommerce
that referenced
this pull request
May 1, 2025
Summary: # Fix Product Variation Fields Not Saving Correctly ## Description This PR fixes an issue where product variation custom fields for Facebook for WooCommerce were not being properly saved and displayed. Specifically, the MPN (Manufacturer Part Number) and custom image URL values weren't being preserved when saving product variations. The issue was caused by two main problems: 1. The MPN field was being incorrectly formatted as a decimal number with `wc_format_decimal()` when rendered, which is inappropriate for an alphanumeric identifier 2. The custom image URL was potentially being overwritten due to variable reuse in the save logic These bugs prevented merchants from properly configuring their product variations for Facebook Catalog sync. ### 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](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](https://fburl.com/wiki/nhx73tgs). ## Changelog entry Fix issue where product variation MPN and custom image URL fields weren't being properly saved and displayed. Pull Request resolved: facebook#3090 Test Plan: 1. Create a variable product with at least one variation 2. Enable Facebook sync for the variation 3. Set a custom MPN value (e.g., "ABC12345") and a custom image URL 4. Save the product 5. Reload the product edit page 6. Verify that the MPN and custom image URL values have been preserved ## Screenshots ### Before https://pxl.cl/74Rzv When saving product variations, the MPN field and custom image URL would not persist after saving. ### After https://pxl.cl/74Rzk The MPN field and custom image URL now correctly display and save the values entered by users. Reviewed By: carterbuce Differential Revision: D73611087 Privacy Context Container: L1313315 Pulled By: devbodaghe fbshipit-source-id: 5308dfb808e63055d033b3da847fde32d0b62885
This was referenced May 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix Product Variation Fields Not Saving Correctly
Description
This PR fixes an issue where product variation custom fields for Facebook for WooCommerce were not being properly saved and displayed. Specifically, the MPN (Manufacturer Part Number) and custom image URL values weren't being preserved when saving product variations.
The issue was caused by two main problems:
wc_format_decimal()when rendered, which is inappropriate for an alphanumeric identifierThese bugs prevented merchants from properly configuring their product variations for Facebook Catalog sync.
Type of change
Checklist
Changelog entry
Fix issue where product variation MPN and custom image URL fields weren't being properly saved and displayed.
Test Plan
Screenshots
Before
When saving product variations, the MPN field and custom image URL would not persist after saving.
After
The MPN field and custom image URL now correctly display and save the values entered by users.