Plugin Directory

Changeset 3239398


Ignore:
Timestamp:
02/12/2025 12:53:33 PM (14 months ago)
Author:
Facebook
Message:

Updating new version 3.3.5

Location:
facebook-for-woocommerce/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • facebook-for-woocommerce/trunk/assets/css/admin/facebook-for-woocommerce-products-admin.css

    r2950496 r3239398  
    1717#woocommerce-product-data .fb-product-image-source-field .wc-radios li:last-child {
    1818    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;
    1949}
    2050
     
    81111    width: 11% !important;
    82112}
     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  
    11*** 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
    25
    36= 3.3.4 - 2025-02-11 =
  • facebook-for-woocommerce/trunk/facebook-commerce.php

    r3235937 r3239398  
    136136    public const FB_PRODUCT_ITEM_ID     = 'fb_product_item_id';
    137137    public const FB_PRODUCT_DESCRIPTION = 'fb_product_description';
    138 
     138    public const FB_RICH_TEXT_DESCRIPTION = 'fb_rich_text_description';
    139139    /** @var string the API flag to set a product as visible in the Facebook shop */
    140140    public const FB_SHOP_PRODUCT_VISIBLE = 'published';
     
    869869        if ( isset( $_POST[ self::FB_PRODUCT_DESCRIPTION ] ) ) {
    870870            $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       
    873874        if ( isset( $_POST[ WC_Facebook_Product::FB_PRODUCT_PRICE ] ) ) {
    874875            $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  
    1212 * Author: Facebook
    1313 * Author URI: https://www.facebook.com/
    14  * Version: 3.3.4
     14 * Version: 3.3.5
    1515 * Requires at least: 5.6
    1616 * Requires PHP: 7.4
     
    5050     * @var string the plugin version. This must be in the main plugin file to be automatically bumped by Woorelease.
    5151     */
    52     const PLUGIN_VERSION = '3.3.4'; // WRCS: DEFINED_VERSION.
     52    const PLUGIN_VERSION = '3.3.5'; // WRCS: DEFINED_VERSION.
    5353
    5454    // Minimum PHP version required by this plugin.
  • facebook-for-woocommerce/trunk/i18n/languages/facebook-for-woocommerce.pot

    r3238498 r3239398  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Facebook for WooCommerce 3.3.4\n"
     5"Project-Id-Version: Facebook for WooCommerce 3.3.5\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/facebook-for-woocommerce\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-02-11T11:03:03+00:00\n"
     12"POT-Creation-Date: 2025-02-12T12:49:55+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.10.0\n"
     
    1919#: class-wc-facebookcommerce.php:759
    2020#: facebook-commerce.php:196
    21 #: includes/Admin.php:1547
     21#: includes/Admin.php:1555
    2222#: includes/Admin/Settings.php:89
    2323#: includes/Admin/Settings.php:160
     
    5252#: includes/Admin/Enhanced_Catalog_Attribute_Fields.php:68
    5353#: includes/fbbackground.php:41
    54 #: includes/fbproduct.php:138
     54#: includes/fbproduct.php:146
    5555msgid "The %s property is private and should not be accessed outside its class."
    5656msgstr ""
     
    108108
    109109#. translators: %1$s is referring to facebook product group id.
    110 #: facebook-commerce.php:1304
     110#: facebook-commerce.php:1305
    111111msgid "Nothing to update for product group for %1$s"
    112112msgstr ""
    113113
    114 #: facebook-commerce.php:2095
     114#: facebook-commerce.php:2096
    115115msgid "Your connection has expired."
    116116msgstr ""
    117117
    118 #: facebook-commerce.php:2095
     118#: facebook-commerce.php:2096
    119119msgid "Please click Manage connection > Advanced Options > Update Token to refresh your connection to Facebook."
    120120msgstr ""
    121121
    122122#. translators: Placeholders %s - error message
    123 #: facebook-commerce.php:2102
     123#: facebook-commerce.php:2103
    124124msgid "There was an error trying to sync the products to Facebook. %s"
    125125msgstr ""
    126126
    127 #: facebook-commerce.php:2121
     127#: facebook-commerce.php:2122
    128128msgid "Product sync is disabled."
    129129msgstr ""
    130130
    131 #: facebook-commerce.php:2126
     131#: facebook-commerce.php:2127
    132132msgid "The plugin is not configured or the Catalog ID is missing."
    133133msgstr ""
    134134
    135 #: facebook-commerce.php:2146
     135#: facebook-commerce.php:2147
    136136msgid "A product sync is in progress. Please wait until the sync finishes before starting a new one."
    137137msgstr ""
    138138
    139 #: facebook-commerce.php:2162
     139#: facebook-commerce.php:2163
    140140msgid "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."
    141141msgstr ""
    142142
    143 #: facebook-commerce.php:2744
     143#: facebook-commerce.php:2745
    144144msgid "Facebook for WooCommerce error:"
    145145msgstr ""
    146146
    147147#. translators: Placeholders %1$s - original error message from Facebook API
    148 #: facebook-commerce.php:2979
     148#: facebook-commerce.php:2980
    149149msgid "There was an issue connecting to the Facebook API: %s"
    150150msgstr ""
     
    220220#: includes/Admin.php:507
    221221#: includes/Admin.php:1210
    222 #: includes/Admin.php:1372
     222#: includes/Admin.php:1379
    223223msgid "Do not sync"
    224224msgstr ""
     
    260260
    261261#: includes/Admin.php:1206
    262 #: includes/Admin.php:1368
     262#: includes/Admin.php:1375
    263263msgid "Facebook Sync"
    264264msgstr ""
    265265
    266266#: includes/Admin.php:1208
    267 #: includes/Admin.php:1370
     267#: includes/Admin.php:1377
    268268msgid "Sync and show in catalog"
    269269msgstr ""
    270270
    271271#: includes/Admin.php:1209
    272 #: includes/Admin.php:1371
     272#: includes/Admin.php:1378
    273273msgid "Sync and hide in catalog"
    274274msgstr ""
    275275
    276276#: includes/Admin.php:1214
    277 #: includes/Admin.php:1376
     277#: includes/Admin.php:1383
    278278msgid "Choose whether to sync this product to Facebook and, if synced, whether it should be visible in the catalog."
    279279msgstr ""
    280280
    281 #: includes/Admin.php:1221
    282 #: includes/Admin.php:1386
     281#: includes/Admin.php:1220
     282#: includes/Admin.php:1393
    283283msgid "Facebook Description"
    284284msgstr ""
    285285
    286 #: includes/Admin.php:1223
    287 #: includes/Admin.php:1388
     286#: includes/Admin.php:1242
     287#: includes/Admin.php:1408
     288msgid "Facebook Product Image"
     289msgstr ""
     290
     291#: includes/Admin.php:1244
     292#: includes/Admin.php:1410
     293msgid "Choose the product image that should be synced to the Facebook catalog and displayed for this product."
     294msgstr ""
     295
     296#: includes/Admin.php:1246
     297msgid "Use WooCommerce image"
     298msgstr ""
     299
     300#: includes/Admin.php:1247
     301#: includes/Admin.php:1414
     302msgid "Use custom image"
     303msgstr ""
     304
     305#: includes/Admin.php:1258
     306#: includes/Admin.php:1426
     307msgid "Custom Image URL"
     308msgstr ""
     309
     310#: includes/Admin.php:1262
     311#: includes/Admin.php:1431
     312msgid "Please enter an absolute URL (e.g. https://domain.com/image.jpg)."
     313msgstr ""
     314
     315#. translators: Placeholders %1$s - WC currency symbol
     316#: includes/Admin.php:1271
     317#: includes/Admin.php:1441
     318msgid "Facebook Price (%1$s)"
     319msgstr ""
     320
     321#: includes/Admin.php:1275
     322#: includes/Admin.php:1445
     323msgid "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."
     324msgstr ""
     325
     326#: includes/Admin.php:1286
     327#: includes/Admin.php:1315
     328msgid "Brand"
     329msgstr ""
     330
     331#: includes/Admin.php:1295
     332#: includes/Admin.php:1456
     333msgid "Manufacturer Parts Number (MPN)"
     334msgstr ""
     335
     336#: includes/Admin.php:1395
    288337msgid "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."
    289338msgstr ""
    290339
    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
    342341msgid "Use variation image"
    343342msgstr ""
    344343
    345 #: includes/Admin.php:1406
     344#: includes/Admin.php:1413
    346345msgid "Use parent image"
    347346msgstr ""
    348347
    349 #: includes/Admin.php:1549
     348#: includes/Admin.php:1557
    350349msgid "Close modal panel"
    351350msgstr ""
  • facebook-for-woocommerce/trunk/includes/Admin.php

    r3238498 r3239398  
    11821182        $product      = wc_get_product( $post );
    11831183
    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 );
    11851185        $price        = get_post_meta( $post->ID, \WC_Facebook_Product::FB_PRODUCT_PRICE, true );
    11861186        $image_source = get_post_meta( $post->ID, Products::PRODUCT_IMAGE_SOURCE_META_KEY, true );
     
    12161216                );
    12171217
    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,
    12191225                    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                        ),
    12281235                    )
    12291236                );
     1237                echo '</div>';
    12301238
    12311239                woocommerce_wp_radio(
     
    13491357        $sync_enabled = 'no' !== $this->get_product_variation_meta( $variation, Products::SYNC_ENABLED_META_KEY, $parent );
    13501358        $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 );     
    13531360        $price        = $this->get_product_variation_meta( $variation, \WC_Facebook_Product::FB_PRODUCT_PRICE, $parent );
    13541361        $image_url    = $this->get_product_variation_meta( $variation, \WC_Facebook_Product::FB_PRODUCT_IMAGE, $parent );
     
    15131520            $price        = isset( $_POST[ $posted_param ][ $index ] ) ? wc_format_decimal( wc_clean( wp_unslash( $_POST[ $posted_param ][ $index ] ) ) ) : '';
    15141521            $variation->update_meta_data( \WC_Facebookcommerce_Integration::FB_PRODUCT_DESCRIPTION, $description );
     1522            $variation->update_meta_data( \WC_Facebookcommerce_Integration::FB_RICH_TEXT_DESCRIPTION, $description );
    15151523            $variation->update_meta_data( Products::PRODUCT_IMAGE_SOURCE_META_KEY, $image_source );
    15161524            $variation->update_meta_data( \WC_Facebook_Product::FB_MPN, $fb_mpn );
  • facebook-for-woocommerce/trunk/includes/fbproduct.php

    r3238498 r3239398  
    3131    // Should match facebook-commerce.php while we migrate that code over
    3232    // 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';
    3940    const FB_BRAND               = 'fb_brand';
    4041    const FB_VARIABLE_BRAND      = 'fb_variable_brand';
     
    9394    public $fb_visibility;
    9495
     96    /**
     97     * @var string Product rich text description.
     98     */
     99    public $rich_text_description;
     100
    95101    public function __construct( $wpid, $parent_product = null ) {
    96102
     
    99105            $this->woo_product = $wpid;
    100106        } 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 );
    103109        }
    104110
     
    108114        $this->main_description       = '';
    109115        $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  = '';
    110117
    111118        if ( $meta = get_post_meta( $this->id, self::FB_VISIBILITY, true ) ) {
     
    122129            $this->fb_use_parent_image = $parent_product->get_use_parent_image();
    123130            $this->main_description    = $parent_product->get_fb_description();
     131            $this->rich_text_description = $parent_product->get_rich_text_description();
    124132        }
    125133    }
     
    239247         */
    240248        $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 );
    242250        $parent_product_image_url = null;
    243251        $custom_image_url         = $this->woo_product->get_meta( self::FB_PRODUCT_IMAGE );
     
    305313                );
    306314            }
    307         }
     315        }
    308316
    309317        return $video_urls;
     
    339347
    340348    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 ) );
    344350        $this->fb_description = $description;
    345351        update_post_meta(
     
    360366            );
    361367        }
     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        );
    362379    }
    363380
     
    409426
    410427    public function set_use_parent_image( $setting ) {
    411         $this->fb_use_parent_image = ( $setting == 'yes' );
     428        $this->fb_use_parent_image = ( $setting === 'yes' );
    412429        update_post_meta(
    413430            $this->id,
     
    507524
    508525    /**
     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    /**
    509585     * @param array $product_data
    510      * @param bool $for_items_batch
     586     * @param bool  $for_items_batch
    511587     *
    512588     * @return array
     
    546622        if ( $for_items_batch ) {
    547623            $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 ) : '';
    549625        } else {
    550626            $product_data['sale_price_start_date'] = $sale_start;
     
    583659            );
    584660            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 );
    587663        } else {
    588664            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 );
    591667        }
    592668    }
     
    728804
    729805        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,
    744821            );
    745822            $product_data   = $this->add_sale_price( $product_data, true );
     
    750827        } else {
    751828            $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 ),
    770848                '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_fields
     849                    '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
    777855            );
    778856
     
    828906            // get_virtual() returns true for "unassembled bundles", so we exclude
    829907            // 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        }
    833911
    834912        if ( self::PRODUCT_PREP_TYPE_FEED !== $type_to_prepare_for ) {
     
    842920
    843921        /**
    844            * Filters the generated product data.
    845            *
    846            * @param int   $id           Woocommerce product id
    847            * @param array $product_data An array of product data
    848            */
     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            */
    849927        return apply_filters(
    850928            'facebook_for_woocommerce_integration_prepare_product',
     
    864942     */
    865943    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();
    867945        if ( empty( $google_category_id ) || ! $category_handler->is_category( $google_category_id ) ) {
    868946            return $product_data;
     
    904982        $matched_attributes = array();
    905983        $sanitized_keys     = array_map(
    906             function( $key ) {
     984            function ( $key ) {
    907985                    return \WC_Facebookcommerce_Utils::sanitize_variant_name( $key, false );
    908986            },
  • facebook-for-woocommerce/trunk/includes/fbutils.php

    r3226418 r3239398  
    253253         * This function should will:
    254254         * 1. Replace newlines chars/nbsp with a real space
    255          * 2. strip_tags()
     255         * 2. strip_tags() if not explicitly stated to not
    256256         * 3. trim()
    257257         *
     
    260260         * @return string
    261261         */
    262         public static function clean_string( $string ) {
     262        public static function clean_string( $string, $strip_html_tags = true ) {
    263263
    264264            /**
     
    270270             * @param string $string           String to clean up.
    271271             */
     272
     273             if (empty($string)){
     274                return '';
     275             }
    272276            $apply_shortcodes = apply_filters( 'wc_facebook_string_apply_shortcodes', false, $string );
    273277            if ( $apply_shortcodes ) {
     
    281285            $string = str_replace( array( '&amp%3B', '&amp;' ), '&', $string );
    282286            $string = str_replace( array( "\r", '&nbsp;', "\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            }
    284290            return $string;
    285291        }
  • facebook-for-woocommerce/trunk/readme.txt

    r3238505 r3239398  
    4040
    4141== Changelog ==
     42= 3.3.5 - 2025-02-12 =
     43* Add - Rich Text Description to Woo Product Sync with Meta by devbodaghe in #2843
     44
    4245= 3.3.4 - 2025-02-11 =
    4346* Fix - Fixing the issue with version number
  • facebook-for-woocommerce/trunk/vendor/composer/installed.php

    r3238498 r3239398  
    44        'pretty_version' => 'dev-main',
    55        'version' => 'dev-main',
    6         'reference' => '70d9f8c0b95f532dd77ef5bab70210772c86b648',
     6        'reference' => 'd811556121474e2f31847ded6f193a2178470cf5',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
     
    2323            'pretty_version' => 'dev-main',
    2424            'version' => 'dev-main',
    25             'reference' => '70d9f8c0b95f532dd77ef5bab70210772c86b648',
     25            'reference' => 'd811556121474e2f31847ded6f193a2178470cf5',
    2626            'type' => 'wordpress-plugin',
    2727            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.