fix: Add parent product material inheritance for variations#3035
Closed
devbodaghe wants to merge 1 commit intofacebook:mainfrom
Closed
fix: Add parent product material inheritance for variations#3035devbodaghe wants to merge 1 commit intofacebook:mainfrom
devbodaghe wants to merge 1 commit 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 d786cdd. |
Closed
6 tasks
vinkmeta
pushed a commit
that referenced
this pull request
Apr 13, 2025
Summary:
## Description
This PR fixes an inconsistency in how product material attributes are handled for variable products in the Facebook for WooCommerce sync process. Previously, variations would not inherit their parent product's material attribute, unlike other attributes such as color and size.
### What Changed
- Added parent fallback logic to `get_fb_material()` method
- Variations now check parent product's material value if no variation-specific material is set
- Maintains existing string sanitization and length limits
### Before
```php
// Only checked variation attributes and direct meta
$fb_material = get_post_meta($this->id, self::FB_MATERIAL, true);
```
### After
```php
// Now includes parent fallback like other attributes
if (empty($fb_material) && $this->is_type('variation')) {
$parent_id = $this->get_parent_id();
if ($parent_id) {
$fb_material = get_post_meta($parent_id, self::FB_MATERIAL, true);
}
}
```
### Testing
1. Create a variable product with a material set at the parent level
2. Create variations without specific material values
3. Verify variations inherit the parent's material when syncing to Facebook
4. Verify variations with their own material values still use their specific value
### Related Issues
- Fixes inconsistent material attribute syncing for variable products
- Aligns material handling with other product attributes
Pull Request resolved: #3035
Reviewed By: vinkmeta
Differential Revision:
D72733411
Privacy Context Container: L1313315
Pulled By: devbodaghe
fbshipit-source-id: 28483bffcdc0563d1af8e98748e8d3a35e9da9b9
This was referenced Apr 14, 2025
Closed
mradmeta
pushed a commit
that referenced
this pull request
Apr 14, 2025
Summary:
## Description
This PR fixes an inconsistency in how product material attributes are handled for variable products in the Facebook for WooCommerce sync process. Previously, variations would not inherit their parent product's material attribute, unlike other attributes such as color and size.
### What Changed
- Added parent fallback logic to `get_fb_material()` method
- Variations now check parent product's material value if no variation-specific material is set
- Maintains existing string sanitization and length limits
### Before
```php
// Only checked variation attributes and direct meta
$fb_material = get_post_meta($this->id, self::FB_MATERIAL, true);
```
### After
```php
// Now includes parent fallback like other attributes
if (empty($fb_material) && $this->is_type('variation')) {
$parent_id = $this->get_parent_id();
if ($parent_id) {
$fb_material = get_post_meta($parent_id, self::FB_MATERIAL, true);
}
}
```
### Testing
1. Create a variable product with a material set at the parent level
2. Create variations without specific material values
3. Verify variations inherit the parent's material when syncing to Facebook
4. Verify variations with their own material values still use their specific value
### Related Issues
- Fixes inconsistent material attribute syncing for variable products
- Aligns material handling with other product attributes
Pull Request resolved: #3035
Reviewed By: vinkmeta
Differential Revision:
D72733411
Privacy Context Container: L1313315
Pulled By: devbodaghe
fbshipit-source-id: 28483bffcdc0563d1af8e98748e8d3a35e9da9b9
vahidkay-meta
pushed a commit
that referenced
this pull request
Apr 15, 2025
Summary:
## Description
This PR fixes an inconsistency in how product material attributes are handled for variable products in the Facebook for WooCommerce sync process. Previously, variations would not inherit their parent product's material attribute, unlike other attributes such as color and size.
### What Changed
- Added parent fallback logic to `get_fb_material()` method
- Variations now check parent product's material value if no variation-specific material is set
- Maintains existing string sanitization and length limits
### Before
```php
// Only checked variation attributes and direct meta
$fb_material = get_post_meta($this->id, self::FB_MATERIAL, true);
```
### After
```php
// Now includes parent fallback like other attributes
if (empty($fb_material) && $this->is_type('variation')) {
$parent_id = $this->get_parent_id();
if ($parent_id) {
$fb_material = get_post_meta($parent_id, self::FB_MATERIAL, true);
}
}
```
### Testing
1. Create a variable product with a material set at the parent level
2. Create variations without specific material values
3. Verify variations inherit the parent's material when syncing to Facebook
4. Verify variations with their own material values still use their specific value
### Related Issues
- Fixes inconsistent material attribute syncing for variable products
- Aligns material handling with other product attributes
Pull Request resolved: #3035
Reviewed By: vinkmeta
Differential Revision:
D72733411
Privacy Context Container: L1313315
Pulled By: devbodaghe
fbshipit-source-id: 28483bffcdc0563d1af8e98748e8d3a35e9da9b9
rubycalling
pushed a commit
that referenced
this pull request
Apr 16, 2025
Summary:
## Description
This PR fixes an inconsistency in how product material attributes are handled for variable products in the Facebook for WooCommerce sync process. Previously, variations would not inherit their parent product's material attribute, unlike other attributes such as color and size.
### What Changed
- Added parent fallback logic to `get_fb_material()` method
- Variations now check parent product's material value if no variation-specific material is set
- Maintains existing string sanitization and length limits
### Before
```php
// Only checked variation attributes and direct meta
$fb_material = get_post_meta($this->id, self::FB_MATERIAL, true);
```
### After
```php
// Now includes parent fallback like other attributes
if (empty($fb_material) && $this->is_type('variation')) {
$parent_id = $this->get_parent_id();
if ($parent_id) {
$fb_material = get_post_meta($parent_id, self::FB_MATERIAL, true);
}
}
```
### Testing
1. Create a variable product with a material set at the parent level
2. Create variations without specific material values
3. Verify variations inherit the parent's material when syncing to Facebook
4. Verify variations with their own material values still use their specific value
### Related Issues
- Fixes inconsistent material attribute syncing for variable products
- Aligns material handling with other product attributes
Pull Request resolved: #3035
Reviewed By: vinkmeta
Differential Revision:
D72733411
Privacy Context Container: L1313315
Pulled By: devbodaghe
fbshipit-source-id: 28483bffcdc0563d1af8e98748e8d3a35e9da9b9
Merged
This was referenced Apr 18, 2025
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.
Description
This PR fixes an inconsistency in how product material attributes are handled for variable products in the Facebook for WooCommerce sync process. Previously, variations would not inherit their parent product's material attribute, unlike other attributes such as color and size.
What Changed
get_fb_material()methodBefore
After
Testing
Related Issues