-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rich text description to woo product sync to meta #2843
base: main
Are you sure you want to change the base?
Add rich text description to woo product sync to meta #2843
Conversation
789f936
to
0029291
Compare
includes/Admin.php
Outdated
@@ -1468,6 +1461,7 @@ public function save_product_variation_edit_fields( $variation_id, $index ) { | |||
Products::set_product_visibility( $variation, self::SYNC_MODE_SYNC_AND_HIDE !== $sync_mode ); | |||
$posted_param = 'variable_' . \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION; | |||
$description = isset( $_POST[ $posted_param ][ $index ] ) ? sanitize_text_field( wp_unslash( $_POST[ $posted_param ][ $index ] ) ) : null; | |||
$posted_param = 'variable_' . \WC_Facebookcommerce_Integration::FB_RICH_TEXT_DESCRIPTION; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this going to be overridden in the next line?
includes/fbproduct.php
Outdated
/** | ||
* @var string Facebook Rich Text Description. | ||
*/ | ||
private $fb_rich_text_description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not seem to be used later
includes/fbproduct.php
Outdated
* 1. Check if the facebook rich text description is set and not empty. | ||
* 2. If the rich text description is available, use it as the preferred description. | ||
* 3. Otherwise, fall back to the plain text description made available by Woocommerce. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 1. Check if the facebook rich text description is set and not empty. | |
* 2. If the rich text description is available, use it as the preferred description. | |
* 3. Otherwise, fall back to the plain text description made available by Woocommerce. | |
* 1. Check if the Facebook rich text description is set and not empty. | |
* 2. If the rich text description is available, use it as the preferred description. | |
* 3. Otherwise, fall back to the plain text description made available by WooCommerce. |
includes/fbproduct.php
Outdated
array( | ||
'title' => WC_Facebookcommerce_Utils::clean_string( $this->get_title() ), | ||
'description' => $this->get_fb_description(), | ||
'rich_text_description' => $rich_text_description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for extra variable
'rich_text_description' => $rich_text_description, | |
'rich_text_description' => $this->get_rich_text_description(), |
includes/fbproduct.php
Outdated
|
||
// Try to get rich text description from post meta if description has been set | ||
if ( empty( $rich_text_description ) ) { | ||
$temp_rich_text_description = get_post_meta( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like $temp_rich_text_description
is not necessary, you can just use $rich_text_description
.
includes/fbproduct.php
Outdated
'price' => $this->get_fb_price( true ), | ||
'availability' => $this->is_in_stock() ? 'in stock' : 'out of stock', | ||
'visibility' => Products::is_product_visible( $this->woo_product ) ? \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_VISIBLE : \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_HIDDEN, | ||
$product_data = array_merge( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What arrays are you merging here? Looks like there is only 1 array.
@@ -555,7 +554,6 @@ public function test_on_product_save_existing_simple_product_sync_enabled_update | |||
|
|||
$facebook_product_to_update = new WC_Facebook_Product( $product_to_update->get_id() ); | |||
|
|||
$this->assertEquals( 'Facebook product description.', get_post_meta( $facebook_product_to_update->get_id(), WC_Facebook_Product::FB_PRODUCT_DESCRIPTION, true ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we not need this assert anymore?
426371c
to
0f7fcb9
Compare
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
2 similar comments
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
04b8d80
to
09791ad
Compare
@devbodaghe has updated the pull request. You must reimport the pull request before landing. |
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@devbodaghe has updated the pull request. You must reimport the pull request before landing. |
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
bc81474
to
ca0c1a4
Compare
@devbodaghe has updated the pull request. You must reimport the pull request before landing. |
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@devbodaghe has updated the pull request. You must reimport the pull request before landing. |
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
bd71a64
to
3fb2156
Compare
@devbodaghe has updated the pull request. You must reimport the pull request before landing. |
@devbodaghe has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Add Rich Text Description to Woo Product Sync with Meta
Description
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
Changes
Benefits
Testing Instructions
Screenshots
Additional Notes
Please let me know if there are any edge cases or scenarios that should be tested further.