Changeset 3239398
- Timestamp:
- 02/12/2025 12:53:33 PM (14 months ago)
- Location:
- facebook-for-woocommerce/trunk
- Files:
-
- 10 edited
-
assets/css/admin/facebook-for-woocommerce-products-admin.css (modified) (2 diffs)
-
changelog.txt (modified) (1 diff)
-
facebook-commerce.php (modified) (2 diffs)
-
facebook-for-woocommerce.php (modified) (2 diffs)
-
i18n/languages/facebook-for-woocommerce.pot (modified) (7 diffs)
-
includes/Admin.php (modified) (4 diffs)
-
includes/fbproduct.php (modified) (19 diffs)
-
includes/fbutils.php (modified) (4 diffs)
-
readme.txt (modified) (1 diff)
-
vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
facebook-for-woocommerce/trunk/assets/css/admin/facebook-for-woocommerce-products-admin.css
r2950496 r3239398 17 17 #woocommerce-product-data .fb-product-image-source-field .wc-radios li:last-child { 18 18 padding-bottom: 0; 19 } 20 21 22 /* Ensure proper spacing between fields */ 23 #facebook_options .options_group { 24 padding: 0; 25 border-top: 1px solid #fff; 26 border-bottom: 1px solid #eee; 27 } 28 29 30 .woocommerce_variable_attributes .wp-editor-wrap label { 31 float: left; 32 width: 150px; 33 padding: 0; 34 color: #666; 35 font-size: 12px; 36 font-weight: 600; 37 line-height: 24px; 38 } 39 40 /* Ensure editor area has proper height */ 41 .wp-editor-area { 42 min-height: 100px; 43 color: #000000 44 } 45 46 /* Match WooCommerce field hover states */ 47 #facebook_options .wp-editor-container:hover { 48 border-color: #666; 19 49 } 20 50 … … 81 111 width: 11% !important; 82 112 } 113 114 .woocommerce_options_panel .wp-editor-container { 115 margin-left: 162px; 116 width: calc(100% - 182px); 117 max-width: 550px; 118 } 119 120 .woocommerce_options_panel .wp-editor-tabs { 121 margin-left: 162px; 122 max-width: 550px; 123 } 124 125 /* Ensure the label aligns properly */ 126 .woocommerce_options_panel label[for="fb_product_description"] { 127 float: left; 128 width: 150px; 129 padding: 0; 130 margin: 0 0 0 12px; 131 } 132 133 /* Ensure the wp-editor-wrap takes full width */ 134 .wp-editor-wrap { 135 width: 100%; 136 max-width: 100%; 137 } -
facebook-for-woocommerce/trunk/changelog.txt
r3238498 r3239398 1 1 *** Facebook for WooCommerce Changelog *** 2 3 = 3.3.5 - 2025-02-12 = 4 * Add - Rich Text Description to Woo Product Sync with Meta by devbodaghe in #2843 2 5 3 6 = 3.3.4 - 2025-02-11 = -
facebook-for-woocommerce/trunk/facebook-commerce.php
r3235937 r3239398 136 136 public const FB_PRODUCT_ITEM_ID = 'fb_product_item_id'; 137 137 public const FB_PRODUCT_DESCRIPTION = 'fb_product_description'; 138 138 public const FB_RICH_TEXT_DESCRIPTION = 'fb_rich_text_description'; 139 139 /** @var string the API flag to set a product as visible in the Facebook shop */ 140 140 public const FB_SHOP_PRODUCT_VISIBLE = 'published'; … … 869 869 if ( isset( $_POST[ self::FB_PRODUCT_DESCRIPTION ] ) ) { 870 870 $woo_product->set_description( sanitize_text_field( wp_unslash( $_POST[ self::FB_PRODUCT_DESCRIPTION ] ) ) ); 871 } 872 871 $woo_product->set_rich_text_description( $_POST[ self::FB_PRODUCT_DESCRIPTION ] ); 872 } 873 873 874 if ( isset( $_POST[ WC_Facebook_Product::FB_PRODUCT_PRICE ] ) ) { 874 875 $woo_product->set_price( sanitize_text_field( wp_unslash( $_POST[ WC_Facebook_Product::FB_PRODUCT_PRICE ] ) ) ); -
facebook-for-woocommerce/trunk/facebook-for-woocommerce.php
r3238498 r3239398 12 12 * Author: Facebook 13 13 * Author URI: https://www.facebook.com/ 14 * Version: 3.3. 414 * Version: 3.3.5 15 15 * Requires at least: 5.6 16 16 * Requires PHP: 7.4 … … 50 50 * @var string the plugin version. This must be in the main plugin file to be automatically bumped by Woorelease. 51 51 */ 52 const PLUGIN_VERSION = '3.3. 4'; // WRCS: DEFINED_VERSION.52 const PLUGIN_VERSION = '3.3.5'; // WRCS: DEFINED_VERSION. 53 53 54 54 // Minimum PHP version required by this plugin. -
facebook-for-woocommerce/trunk/i18n/languages/facebook-for-woocommerce.pot
r3238498 r3239398 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Facebook for WooCommerce 3.3. 4\n"5 "Project-Id-Version: Facebook for WooCommerce 3.3.5\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/facebook-for-woocommerce\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025-02-1 1T11:03:03+00:00\n"12 "POT-Creation-Date: 2025-02-12T12:49:55+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.10.0\n" … … 19 19 #: class-wc-facebookcommerce.php:759 20 20 #: facebook-commerce.php:196 21 #: includes/Admin.php:15 4721 #: includes/Admin.php:1555 22 22 #: includes/Admin/Settings.php:89 23 23 #: includes/Admin/Settings.php:160 … … 52 52 #: includes/Admin/Enhanced_Catalog_Attribute_Fields.php:68 53 53 #: includes/fbbackground.php:41 54 #: includes/fbproduct.php:1 3854 #: includes/fbproduct.php:146 55 55 msgid "The %s property is private and should not be accessed outside its class." 56 56 msgstr "" … … 108 108 109 109 #. translators: %1$s is referring to facebook product group id. 110 #: facebook-commerce.php:130 4110 #: facebook-commerce.php:1305 111 111 msgid "Nothing to update for product group for %1$s" 112 112 msgstr "" 113 113 114 #: facebook-commerce.php:209 5114 #: facebook-commerce.php:2096 115 115 msgid "Your connection has expired." 116 116 msgstr "" 117 117 118 #: facebook-commerce.php:209 5118 #: facebook-commerce.php:2096 119 119 msgid "Please click Manage connection > Advanced Options > Update Token to refresh your connection to Facebook." 120 120 msgstr "" 121 121 122 122 #. translators: Placeholders %s - error message 123 #: facebook-commerce.php:210 2123 #: facebook-commerce.php:2103 124 124 msgid "There was an error trying to sync the products to Facebook. %s" 125 125 msgstr "" 126 126 127 #: facebook-commerce.php:212 1127 #: facebook-commerce.php:2122 128 128 msgid "Product sync is disabled." 129 129 msgstr "" 130 130 131 #: facebook-commerce.php:212 6131 #: facebook-commerce.php:2127 132 132 msgid "The plugin is not configured or the Catalog ID is missing." 133 133 msgstr "" 134 134 135 #: facebook-commerce.php:214 6135 #: facebook-commerce.php:2147 136 136 msgid "A product sync is in progress. Please wait until the sync finishes before starting a new one." 137 137 msgstr "" 138 138 139 #: facebook-commerce.php:216 2139 #: facebook-commerce.php:2163 140 140 msgid "We've detected that your Facebook Product Catalog is no longer valid. This may happen if it was deleted, but could also be a temporary error. If the error persists, please click Manage connection > Advanced Options > Remove and setup the plugin again." 141 141 msgstr "" 142 142 143 #: facebook-commerce.php:274 4143 #: facebook-commerce.php:2745 144 144 msgid "Facebook for WooCommerce error:" 145 145 msgstr "" 146 146 147 147 #. translators: Placeholders %1$s - original error message from Facebook API 148 #: facebook-commerce.php:29 79148 #: facebook-commerce.php:2980 149 149 msgid "There was an issue connecting to the Facebook API: %s" 150 150 msgstr "" … … 220 220 #: includes/Admin.php:507 221 221 #: includes/Admin.php:1210 222 #: includes/Admin.php:137 2222 #: includes/Admin.php:1379 223 223 msgid "Do not sync" 224 224 msgstr "" … … 260 260 261 261 #: includes/Admin.php:1206 262 #: includes/Admin.php:13 68262 #: includes/Admin.php:1375 263 263 msgid "Facebook Sync" 264 264 msgstr "" 265 265 266 266 #: includes/Admin.php:1208 267 #: includes/Admin.php:137 0267 #: includes/Admin.php:1377 268 268 msgid "Sync and show in catalog" 269 269 msgstr "" 270 270 271 271 #: includes/Admin.php:1209 272 #: includes/Admin.php:137 1272 #: includes/Admin.php:1378 273 273 msgid "Sync and hide in catalog" 274 274 msgstr "" 275 275 276 276 #: includes/Admin.php:1214 277 #: includes/Admin.php:13 76277 #: includes/Admin.php:1383 278 278 msgid "Choose whether to sync this product to Facebook and, if synced, whether it should be visible in the catalog." 279 279 msgstr "" 280 280 281 #: includes/Admin.php:122 1282 #: includes/Admin.php:13 86281 #: includes/Admin.php:1220 282 #: includes/Admin.php:1393 283 283 msgid "Facebook Description" 284 284 msgstr "" 285 285 286 #: includes/Admin.php:1223 287 #: includes/Admin.php:1388 286 #: includes/Admin.php:1242 287 #: includes/Admin.php:1408 288 msgid "Facebook Product Image" 289 msgstr "" 290 291 #: includes/Admin.php:1244 292 #: includes/Admin.php:1410 293 msgid "Choose the product image that should be synced to the Facebook catalog and displayed for this product." 294 msgstr "" 295 296 #: includes/Admin.php:1246 297 msgid "Use WooCommerce image" 298 msgstr "" 299 300 #: includes/Admin.php:1247 301 #: includes/Admin.php:1414 302 msgid "Use custom image" 303 msgstr "" 304 305 #: includes/Admin.php:1258 306 #: includes/Admin.php:1426 307 msgid "Custom Image URL" 308 msgstr "" 309 310 #: includes/Admin.php:1262 311 #: includes/Admin.php:1431 312 msgid "Please enter an absolute URL (e.g. https://domain.com/image.jpg)." 313 msgstr "" 314 315 #. translators: Placeholders %1$s - WC currency symbol 316 #: includes/Admin.php:1271 317 #: includes/Admin.php:1441 318 msgid "Facebook Price (%1$s)" 319 msgstr "" 320 321 #: includes/Admin.php:1275 322 #: includes/Admin.php:1445 323 msgid "Custom price for product on Facebook. Please enter in monetary decimal (.) format without thousand separators and currency symbols. If blank, product price will be used." 324 msgstr "" 325 326 #: includes/Admin.php:1286 327 #: includes/Admin.php:1315 328 msgid "Brand" 329 msgstr "" 330 331 #: includes/Admin.php:1295 332 #: includes/Admin.php:1456 333 msgid "Manufacturer Parts Number (MPN)" 334 msgstr "" 335 336 #: includes/Admin.php:1395 288 337 msgid "Custom (plain-text only) description for product on Facebook. If blank, product description will be used. If product description is blank, shortname will be used." 289 338 msgstr "" 290 339 291 #: includes/Admin.php:1234 292 #: includes/Admin.php:1401 293 msgid "Facebook Product Image" 294 msgstr "" 295 296 #: includes/Admin.php:1236 297 #: includes/Admin.php:1403 298 msgid "Choose the product image that should be synced to the Facebook catalog and displayed for this product." 299 msgstr "" 300 301 #: includes/Admin.php:1238 302 msgid "Use WooCommerce image" 303 msgstr "" 304 305 #: includes/Admin.php:1239 306 #: includes/Admin.php:1407 307 msgid "Use custom image" 308 msgstr "" 309 310 #: includes/Admin.php:1250 311 #: includes/Admin.php:1419 312 msgid "Custom Image URL" 313 msgstr "" 314 315 #: includes/Admin.php:1254 316 #: includes/Admin.php:1424 317 msgid "Please enter an absolute URL (e.g. https://domain.com/image.jpg)." 318 msgstr "" 319 320 #. translators: Placeholders %1$s - WC currency symbol 321 #: includes/Admin.php:1263 322 #: includes/Admin.php:1434 323 msgid "Facebook Price (%1$s)" 324 msgstr "" 325 326 #: includes/Admin.php:1267 327 #: includes/Admin.php:1438 328 msgid "Custom price for product on Facebook. Please enter in monetary decimal (.) format without thousand separators and currency symbols. If blank, product price will be used." 329 msgstr "" 330 331 #: includes/Admin.php:1278 332 #: includes/Admin.php:1307 333 msgid "Brand" 334 msgstr "" 335 336 #: includes/Admin.php:1287 337 #: includes/Admin.php:1449 338 msgid "Manufacturer Parts Number (MPN)" 339 msgstr "" 340 341 #: includes/Admin.php:1405 340 #: includes/Admin.php:1412 342 341 msgid "Use variation image" 343 342 msgstr "" 344 343 345 #: includes/Admin.php:14 06344 #: includes/Admin.php:1413 346 345 msgid "Use parent image" 347 346 msgstr "" 348 347 349 #: includes/Admin.php:15 49348 #: includes/Admin.php:1557 350 349 msgid "Close modal panel" 351 350 msgstr "" -
facebook-for-woocommerce/trunk/includes/Admin.php
r3238498 r3239398 1182 1182 $product = wc_get_product( $post ); 1183 1183 1184 $ description = get_post_meta( $post->ID, \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION, true );1184 $rich_text_description = get_post_meta( $post->ID, \WC_Facebookcommerce_Integration::FB_RICH_TEXT_DESCRIPTION, true ); 1185 1185 $price = get_post_meta( $post->ID, \WC_Facebook_Product::FB_PRODUCT_PRICE, true ); 1186 1186 $image_source = get_post_meta( $post->ID, Products::PRODUCT_IMAGE_SOURCE_META_KEY, true ); … … 1216 1216 ); 1217 1217 1218 woocommerce_wp_textarea_input( 1218 echo '<div class="wp-editor-wrap">'; 1219 echo '<label for="' . esc_attr(\WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION) . '">' . 1220 esc_html__( 'Facebook Description', 'facebook-for-woocommerce' ) . 1221 '</label>'; 1222 wp_editor( 1223 $rich_text_description, 1224 \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION, 1219 1225 array( 1220 'id' => \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION, 1221 'label' => __( 'Facebook Description', 'facebook-for-woocommerce' ), 1222 'desc_tip' => true, 1223 'description' => __( 'Custom (plain-text only) description for product on Facebook. If blank, product description will be used. If product description is blank, shortname will be used.', 'facebook-for-woocommerce' ), 1224 'cols' => 40, 1225 'rows' => 20, 1226 'value' => $description, 1227 'class' => 'short enable-if-sync-enabled', 1226 'id' => 'wc_facebook_sync_mode', 1227 'textarea_name' => \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION, 1228 'textarea_rows' => 10, 1229 'media_buttons' => true, 1230 'teeny' => true, 1231 'quicktags' => false, 1232 'tinymce' => array( 1233 'toolbar1' => 'bold,italic,bullist,spellchecker,fullscreen', 1234 ), 1228 1235 ) 1229 1236 ); 1237 echo '</div>'; 1230 1238 1231 1239 woocommerce_wp_radio( … … 1349 1357 $sync_enabled = 'no' !== $this->get_product_variation_meta( $variation, Products::SYNC_ENABLED_META_KEY, $parent ); 1350 1358 $is_visible = ( $visibility = $this->get_product_variation_meta( $variation, Products::VISIBILITY_META_KEY, $parent ) ) ? wc_string_to_bool( $visibility ) : true; 1351 1352 $description = $this->get_product_variation_meta( $variation, \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION, $parent ); 1359 $description = $this->get_product_variation_meta( $variation, \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION, $parent ); 1353 1360 $price = $this->get_product_variation_meta( $variation, \WC_Facebook_Product::FB_PRODUCT_PRICE, $parent ); 1354 1361 $image_url = $this->get_product_variation_meta( $variation, \WC_Facebook_Product::FB_PRODUCT_IMAGE, $parent ); … … 1513 1520 $price = isset( $_POST[ $posted_param ][ $index ] ) ? wc_format_decimal( wc_clean( wp_unslash( $_POST[ $posted_param ][ $index ] ) ) ) : ''; 1514 1521 $variation->update_meta_data( \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION, $description ); 1522 $variation->update_meta_data( \WC_Facebookcommerce_Integration::FB_RICH_TEXT_DESCRIPTION, $description ); 1515 1523 $variation->update_meta_data( Products::PRODUCT_IMAGE_SOURCE_META_KEY, $image_source ); 1516 1524 $variation->update_meta_data( \WC_Facebook_Product::FB_MPN, $fb_mpn ); -
facebook-for-woocommerce/trunk/includes/fbproduct.php
r3238498 r3239398 31 31 // Should match facebook-commerce.php while we migrate that code over 32 32 // to this object. 33 const FB_PRODUCT_DESCRIPTION = 'fb_product_description'; 34 const FB_PRODUCT_PRICE = 'fb_product_price'; 35 const FB_PRODUCT_IMAGE = 'fb_product_image'; 36 const FB_VARIANT_IMAGE = 'fb_image'; 37 const FB_VISIBILITY = 'fb_visibility'; 38 const FB_REMOVE_FROM_SYNC = 'fb_remove_from_sync'; 33 const FB_PRODUCT_DESCRIPTION = 'fb_product_description'; 34 const FB_PRODUCT_PRICE = 'fb_product_price'; 35 const FB_PRODUCT_IMAGE = 'fb_product_image'; 36 const FB_VARIANT_IMAGE = 'fb_image'; 37 const FB_VISIBILITY = 'fb_visibility'; 38 const FB_REMOVE_FROM_SYNC = 'fb_remove_from_sync'; 39 const FB_RICH_TEXT_DESCRIPTION = 'fb_rich_text_description'; 39 40 const FB_BRAND = 'fb_brand'; 40 41 const FB_VARIABLE_BRAND = 'fb_variable_brand'; … … 93 94 public $fb_visibility; 94 95 96 /** 97 * @var string Product rich text description. 98 */ 99 public $rich_text_description; 100 95 101 public function __construct( $wpid, $parent_product = null ) { 96 102 … … 99 105 $this->woo_product = $wpid; 100 106 } else { 101 $this->id = $wpid;102 $this->woo_product = wc_get_product( $wpid );107 $this->id = $wpid; 108 $this->woo_product = wc_get_product( $wpid ); 103 109 } 104 110 … … 108 114 $this->main_description = ''; 109 115 $this->sync_short_description = \WC_Facebookcommerce_Integration::PRODUCT_DESCRIPTION_MODE_SHORT === facebook_for_woocommerce()->get_integration()->get_product_description_mode(); 116 $this->rich_text_description = ''; 110 117 111 118 if ( $meta = get_post_meta( $this->id, self::FB_VISIBILITY, true ) ) { … … 122 129 $this->fb_use_parent_image = $parent_product->get_use_parent_image(); 123 130 $this->main_description = $parent_product->get_fb_description(); 131 $this->rich_text_description = $parent_product->get_rich_text_description(); 124 132 } 125 133 } … … 239 247 */ 240 248 $image_size = apply_filters( 'facebook_for_woocommerce_fb_product_image_size', 'full' ); 241 $product_image_url = wp_get_attachment_image_url( $this->woo_product->get_image_id(), $image_size ); ;249 $product_image_url = wp_get_attachment_image_url( $this->woo_product->get_image_id(), $image_size ); 242 250 $parent_product_image_url = null; 243 251 $custom_image_url = $this->woo_product->get_meta( self::FB_PRODUCT_IMAGE ); … … 305 313 ); 306 314 } 307 }315 } 308 316 309 317 return $video_urls; … … 339 347 340 348 public function set_description( $description ) { 341 $description = stripslashes( 342 WC_Facebookcommerce_Utils::clean_string( $description ) 343 ); 349 $description = stripslashes( WC_Facebookcommerce_Utils::clean_string( $description ) ); 344 350 $this->fb_description = $description; 345 351 update_post_meta( … … 360 366 ); 361 367 } 368 } 369 370 public function set_rich_text_description( $rich_text_description ) { 371 $rich_text_description = 372 WC_Facebookcommerce_Utils::clean_string( $rich_text_description, false ); 373 $this->rich_text_description = $rich_text_description; 374 update_post_meta( 375 $this->id, 376 self::FB_RICH_TEXT_DESCRIPTION, 377 $rich_text_description 378 ); 362 379 } 363 380 … … 409 426 410 427 public function set_use_parent_image( $setting ) { 411 $this->fb_use_parent_image = ( $setting == 'yes' );428 $this->fb_use_parent_image = ( $setting === 'yes' ); 412 429 update_post_meta( 413 430 $this->id, … … 507 524 508 525 /** 526 * Get the rich text description for a product. 527 * 528 * This function retrieves the rich text product description, prioritizing Facebook 529 * rich text descriptions over WooCommerce product descriptions. 530 * 1. Check if the Facebook rich text description is set and not empty. 531 * 2. If the rich text description is not set or empty, use the WooCommerce RTD if available. 532 * 533 * @return string The rich text description for the product. 534 */ 535 public function get_rich_text_description() { 536 $rich_text_description = ''; 537 538 // Check if the fb description is set as that takes preference 539 if ( $this->rich_text_description ) { 540 $rich_text_description = $this->rich_text_description; 541 } elseif ( $this->fb_description ) { 542 $rich_text_description = $this->fb_description; 543 } 544 545 // Try to get rich text description from post meta if description has been set 546 if ( empty( $rich_text_description ) ) { 547 $rich_text_description = get_post_meta( 548 $this->id, 549 self::FB_RICH_TEXT_DESCRIPTION, 550 true 551 ); 552 553 } 554 555 // For variable products, we want to use the rich text description of the variant. 556 // If that's not available, fall back to the main (parent) product's rich text description. 557 if ( empty( $rich_text_description ) && WC_Facebookcommerce_Utils::is_variation_type( $this->woo_product->get_type() ) ) { 558 $rich_text_description = WC_Facebookcommerce_Utils::clean_string( $this->woo_product->get_description(), false ); 559 560 // If the variant's rich text description is still empty, use the main product's rich text description as a fallback 561 if ( empty( $rich_text_description ) && $this->main_description ) { 562 $rich_text_description = $this->main_description; 563 } 564 } 565 566 // If no description is found from meta or variation, get from product 567 if ( empty( $rich_text_description ) ) { 568 $post = $this->get_post_data(); 569 $post_content = WC_Facebookcommerce_Utils::clean_string( $post->post_content, false ); 570 $post_excerpt = WC_Facebookcommerce_Utils::clean_string( $post->post_excerpt, false ); 571 572 if ( ! empty( $post_content ) ) { 573 $rich_text_description = $post_content; 574 } 575 576 if ( $this->sync_short_description || ( empty( $rich_text_description ) && ! empty( $post_excerpt ) ) ) { 577 $rich_text_description = $post_excerpt; 578 } 579 } 580 581 return apply_filters( 'facebook_for_woocommerce_fb_rich_text_description', $rich_text_description, $this->id ); 582 } 583 584 /** 509 585 * @param array $product_data 510 * @param bool $for_items_batch586 * @param bool $for_items_batch 511 587 * 512 588 * @return array … … 546 622 if ( $for_items_batch ) { 547 623 $product_data['sale_price_effective_date'] = $sale_price_effective_date; 548 $product_data['sale_price'] = is_numeric( $sale_price ) ? self::format_price_for_fb_items_batch( $sale_price ) : "";624 $product_data['sale_price'] = is_numeric( $sale_price ) ? self::format_price_for_fb_items_batch( $sale_price ) : ''; 549 625 } else { 550 626 $product_data['sale_price_start_date'] = $sale_start; … … 583 659 ); 584 660 return get_option( 'woocommerce_tax_display_shop' ) === 'incl' 585 ? wc_get_price_including_tax( $woo_product, $args )586 : wc_get_price_excluding_tax( $woo_product, $args );661 ? wc_get_price_including_tax( $woo_product, $args ) 662 : wc_get_price_excluding_tax( $woo_product, $args ); 587 663 } else { 588 664 return get_option( 'woocommerce_tax_display_shop' ) === 'incl' 589 ? $woo_product->get_price_including_tax( 1, $price )590 : $woo_product->get_price_excluding_tax( 1, $price );665 ? $woo_product->get_price_including_tax( 1, $price ) 666 : $woo_product->get_price_excluding_tax( 1, $price ); 591 667 } 592 668 } … … 728 804 729 805 if ( self::PRODUCT_PREP_TYPE_ITEMS_BATCH === $type_to_prepare_for ) { 730 $product_data = array( 731 'title' => WC_Facebookcommerce_Utils::clean_string( $this->get_title() ), 732 'description' => $this->get_fb_description(), 733 'image_link' => $image_urls[0], 734 'additional_image_link' => $this->get_additional_image_urls( $image_urls ), 735 'link' => $product_url, 736 'product_type' => $categories['categories'], 737 'brand' => Helper::str_truncate( $this->get_fb_brand(), 100 ), 738 'mpn' => Helper::str_truncate( $this->get_fb_mpn(), 100 ), 739 'retailer_id' => $retailer_id, 740 'price' => $this->get_fb_price( true ), 741 'availability' => $this->is_in_stock() ? 'in stock' : 'out of stock', 742 'visibility' => Products::is_product_visible( $this->woo_product ) ? \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_VISIBLE : \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_HIDDEN, 743 'custom_fields' => $custom_fields 806 $product_data = array( 807 'title' => WC_Facebookcommerce_Utils::clean_string( $this->get_title() ), 808 'description' => $this->get_fb_description(), 809 'rich_text_description' => $this->get_rich_text_description(), 810 'image_link' => $image_urls[0], 811 'additional_image_link' => $this->get_additional_image_urls( $image_urls ), 812 'link' => $product_url, 813 'product_type' => $categories['categories'], 814 'brand' => Helper::str_truncate( $this->get_fb_brand(), 100 ), 815 'mpn' => Helper::str_truncate( $this->get_fb_mpn(), 100 ), 816 'retailer_id' => $retailer_id, 817 'price' => $this->get_fb_price( true ), 818 'availability' => $this->is_in_stock() ? 'in stock' : 'out of stock', 819 'visibility' => Products::is_product_visible( $this->woo_product ) ? \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_VISIBLE : \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_HIDDEN, 820 'custom_fields' => $custom_fields, 744 821 ); 745 822 $product_data = $this->add_sale_price( $product_data, true ); … … 750 827 } else { 751 828 $product_data = array( 752 'name' => WC_Facebookcommerce_Utils::clean_string( $this->get_title() ), 753 'description' => $this->get_fb_description(), 754 'image_url' => $image_urls[0], 755 'additional_image_urls' => $this->get_additional_image_urls( $image_urls ), 756 'url' => $product_url, 757 /** 758 * 'category' is a required field for creating a ProductItem object when posting to /{product_catalog_id}/products. 759 * This field should have the Google product category for the item. Google product category is not a required field 760 * in the WooCommerce product editor. Hence, we are setting 'category' to Woo product categories by default and overriding 761 * it when a Google product category is set. 762 * 763 * @see https://developers.facebook.com/docs/marketing-api/reference/product-catalog/products/#parameters-2 764 * @see https://github.com/woocommerce/facebook-for-woocommerce/pull/2575 765 * @see https://github.com/woocommerce/facebook-for-woocommerce/issues/2593 766 */ 767 'category' => $categories['categories'], 768 'product_type' => $categories['categories'], 769 'brand' => Helper::str_truncate( $this->get_fb_brand(), 100 ), 829 'name' => WC_Facebookcommerce_Utils::clean_string( $this->get_title() ), 830 'description' => $this->get_fb_description(), 831 'image_url' => $image_urls[0], 832 'additional_image_urls' => $this->get_additional_image_urls( $image_urls ), 833 'url' => $product_url, 834 'rich_text_description' => $this->get_rich_text_description(), 835 /** 836 * 'category' is a required field for creating a ProductItem object when posting to /{product_catalog_id}/products. 837 * This field should have the Google product category for the item. Google product category is not a required field 838 * in the WooCommerce product editor. Hence, we are setting 'category' to Woo product categories by default and overriding 839 * it when a Google product category is set. 840 * 841 * @see https://developers.facebook.com/docs/marketing-api/reference/product-catalog/products/#parameters-2 842 * @see https://github.com/woocommerce/facebook-for-woocommerce/pull/2575 843 * @see https://github.com/woocommerce/facebook-for-woocommerce/issues/2593 844 */ 845 'category' => $categories['categories'], 846 'product_type' => $categories['categories'], 847 'brand' => Helper::str_truncate( $this->get_fb_brand(), 100 ), 770 848 'mpn' => Helper::str_truncate( $this->get_fb_mpn(), 100 ), 771 'retailer_id' => $retailer_id,772 'price' => $this->get_fb_price(),773 'currency' => get_woocommerce_currency(),774 'availability' => $this->is_in_stock() ? 'in stock' : 'out of stock',775 'visibility' => Products::is_product_visible( $this->woo_product ) ? \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_VISIBLE : \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_HIDDEN,776 'custom_fields' => $custom_fields849 'retailer_id' => $retailer_id, 850 'price' => $this->get_fb_price(), 851 'currency' => get_woocommerce_currency(), 852 'availability' => $this->is_in_stock() ? 'in stock' : 'out of stock', 853 'visibility' => Products::is_product_visible( $this->woo_product ) ? \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_VISIBLE : \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_HIDDEN, 854 'custom_fields' => $custom_fields 777 855 ); 778 856 … … 828 906 // get_virtual() returns true for "unassembled bundles", so we exclude 829 907 // bundles from this check. 830 if ( true === $this->get_virtual() && 'bundle' !== $this->get_type() ) {831 $product_data['visibility'] = \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_HIDDEN;832 }908 if ( true === $this->get_virtual() && 'bundle' !== $this->get_type() ) { 909 $product_data['visibility'] = \WC_Facebookcommerce_Integration::FB_SHOP_PRODUCT_HIDDEN; 910 } 833 911 834 912 if ( self::PRODUCT_PREP_TYPE_FEED !== $type_to_prepare_for ) { … … 842 920 843 921 /** 844 * Filters the generated product data.845 *846 * @param int $id Woocommerce product id847 * @param array $product_data An array of product data848 */922 * Filters the generated product data. 923 * 924 * @param int $id Woocommerce product id 925 * @param array $product_data An array of product data 926 */ 849 927 return apply_filters( 850 928 'facebook_for_woocommerce_integration_prepare_product', … … 864 942 */ 865 943 private function apply_enhanced_catalog_fields_from_attributes( $product_data, $google_category_id ) { 866 $category_handler = facebook_for_woocommerce()->get_facebook_category_handler();944 $category_handler = facebook_for_woocommerce()->get_facebook_category_handler(); 867 945 if ( empty( $google_category_id ) || ! $category_handler->is_category( $google_category_id ) ) { 868 946 return $product_data; … … 904 982 $matched_attributes = array(); 905 983 $sanitized_keys = array_map( 906 function ( $key ) {984 function ( $key ) { 907 985 return \WC_Facebookcommerce_Utils::sanitize_variant_name( $key, false ); 908 986 }, -
facebook-for-woocommerce/trunk/includes/fbutils.php
r3226418 r3239398 253 253 * This function should will: 254 254 * 1. Replace newlines chars/nbsp with a real space 255 * 2. strip_tags() 255 * 2. strip_tags() if not explicitly stated to not 256 256 * 3. trim() 257 257 * … … 260 260 * @return string 261 261 */ 262 public static function clean_string( $string ) {262 public static function clean_string( $string, $strip_html_tags = true ) { 263 263 264 264 /** … … 270 270 * @param string $string String to clean up. 271 271 */ 272 273 if (empty($string)){ 274 return ''; 275 } 272 276 $apply_shortcodes = apply_filters( 'wc_facebook_string_apply_shortcodes', false, $string ); 273 277 if ( $apply_shortcodes ) { … … 281 285 $string = str_replace( array( '&%3B', '&' ), '&', $string ); 282 286 $string = str_replace( array( "\r", ' ', "\t" ), ' ', $string ); 283 $string = wp_strip_all_tags( $string, false ); // true == remove line breaks 287 if ($strip_html_tags){ 288 $string = wp_strip_all_tags( $string, false ); // true == remove line breaks 289 } 284 290 return $string; 285 291 } -
facebook-for-woocommerce/trunk/readme.txt
r3238505 r3239398 40 40 41 41 == Changelog == 42 = 3.3.5 - 2025-02-12 = 43 * Add - Rich Text Description to Woo Product Sync with Meta by devbodaghe in #2843 44 42 45 = 3.3.4 - 2025-02-11 = 43 46 * Fix - Fixing the issue with version number -
facebook-for-woocommerce/trunk/vendor/composer/installed.php
r3238498 r3239398 4 4 'pretty_version' => 'dev-main', 5 5 'version' => 'dev-main', 6 'reference' => ' 70d9f8c0b95f532dd77ef5bab70210772c86b648',6 'reference' => 'd811556121474e2f31847ded6f193a2178470cf5', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 23 23 'pretty_version' => 'dev-main', 24 24 'version' => 'dev-main', 25 'reference' => ' 70d9f8c0b95f532dd77ef5bab70210772c86b648',25 'reference' => 'd811556121474e2f31847ded6f193a2178470cf5', 26 26 'type' => 'wordpress-plugin', 27 27 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.