• Resolved golfball-uhu

    (@golfball-uhu)


    Hi,

    I would like to clarify an issue we are seeing with product descriptions in Meta feeds, specifically regarding HTML content wrapped in CDATA.Current situation

    With recent versions of the feed plugin, product descriptions are exported like this:

    <![CDATA[
    <strong>Volvik Solice Golf Balls Metallic – 12 pack</strong>
    Structure
    <ul>
    <li>3-piece ball</li>
    <li>Nano Dual High Energy Core</li>
    <li>322 dimple design</li>
    <li>Metallic coating</li>
    </ul>
    Properties
    <ul>
    <li>Soft feel</li>
    <li>Stable ball flight</li>
    </ul>
    ]]>

    Technically:

    • The feed is valid XML
    • Meta accepts and ingests the feed without errors
    • Ad campaigns usually show only the product title, so the issue is not visible there

    However:Actual problem

    In the Meta Shop / Commerce Manager product view, the description is rendered as raw HTML text, for example:

    <strong>Volvik Solice Golf Balls Metallic – 12 pack</strong>Structure<ul><li>3-piece ball</li><li>...</li></ul>Properties<ul>...

    This results in:

    • Very poor readability
    • No visual formatting
    • A clearly broken product description from a user perspective

    So while HTML + CDATA is accepted by Meta, it is not rendered properly in the Meta Shop UI.Important clarification

    I understand (and agree) that:

    • HTML + CDATA is technically valid
    • Google Merchant Center explicitly supports this
    • Meta does not reject such feeds

    But in practice:

    Accepted ≠ properly rendered

    For Meta Shops, plain text descriptions clearly produce much better results.Question / request

    Is there:

    • a recommended way to strip HTML automatically for Meta feeds?
    • a way to output plain text only (no <ul>, <li>, <strong>, etc.)?
    • or a best-practice recommendation specifically for Meta Shop compatibility?

    Right now the feed is valid, but the frontend presentation in Meta Shop is not usable.

    Thanks in advance for any guidance or recommendations.

    Best regards
    René

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Jeff Alvarez

    (@superlemon1998)

    Hi @golfball-uhu ,

    On your Meta feed, are you perhaps using the rich_text_description  or the regular description attribute? As we output CDATA for formatting, I suggest using rich_text_description

    The regular description doesn’t play well with formatting compared to rich text description

    Learn more about it here: https://www.facebook.com/business/help/120325381656392?id=725943027795860

    Thread Starter golfball-uhu

    (@golfball-uhu)

    Hi Jeff,

    “are you perhaps using the rich_text_description  or the regular description attribute”?

    In the old feed (13.4.2) I´m using “g:description” + “parent description parent product”…which is working.

    Within the new version of the plugin 13.5.0 and now 13.5.2 “g:description” is NOT available anymore.

    I tried “description (description)” + “parent description parent product” and “rich_text_description (rich_text_description) + “parent description parent product”.

    Both resulted in the problematic outcome I described: the description is rendered as raw HTML text.

    Regards

    René

    • This reply was modified 1 month, 3 weeks ago by golfball-uhu.
    • This reply was modified 1 month, 3 weeks ago by golfball-uhu.
    Plugin Support Jeff Alvarez

    (@superlemon1998)

    Hi @golfball-uhu ,

    Try this snippet, add it to your child theme’s function.php or through the WP Code plugin. This will remove any formatting for your description.

    /**
    * Product Feed Pro: Strip all HTML/formatting from description output.
    * Removes tags such as <li>, <strong>, <em>, <italic>, etc. so the feed contains plain text only.
    *
    * @param array $product_data Product data array for the feed.
    * @param object $feed The feed object.
    * @param object $product The WC_Product object.
    * @return array Modified product data.
    */
    function storefront_pfp_strip_description_formatting( $product_data, $feed, $product ) {
    $description_keys = array( 'description', 'short_description' );
    foreach ( $description_keys as $key ) {
    if ( ! empty( $product_data[ $key ] ) && is_string( $product_data[ $key ] ) ) {
    $product_data[ $key ] = wp_strip_all_tags( $product_data[ $key ] );
    $product_data[ $key ] = preg_replace( '/\s+/', ' ', $product_data[ $key ] );
    $product_data[ $key ] = trim( $product_data[ $key ] );
    }
    }
    return $product_data;
    }
    add_filter( 'adt_get_product_data', 'storefront_pfp_strip_description_formatting', 5, 3 );
    Thread Starter golfball-uhu

    (@golfball-uhu)

    Hi Jeff,

    thx for the code.

    I did add it to my functions.php….refreshed the feed…emptied cache….but I can see NO change in the feed.

    It still contains tags such as <li>, <strong> etc. for both variations of description: “description (description)” + “parent description parent product” and “rich_text_description (rich_text_description) + “parent description parent product”.

    Regards

    René

    Plugin Support Jeff Alvarez

    (@superlemon1998)

    Hi @golfball-uhu ,

    Just to confirm the snippet is added and saved because I tried it again and it works: https://www.loom.com/share/815fdd21a63947f0a1d18fad8e2edc8b

    Are you perhaps using different ways set the description for the product? Also, do try using the rule and filters(find and replace): https://ibb.co/Cp6jhZDv and find the html code and replace it

    Thread Starter golfball-uhu

    (@golfball-uhu)

    Hi Jeff,

    I watched your video and everything seems to be ok and your code works.

    BUT: I needed some time to realize….you are using a Google Feed in your video and I told you from the beginning on…I´m using a Meta-Feed…but ok.

    The Meta Feed still contains tags such as <li>, <strong> etc….even with you code….and even after updating from 3.5.2 to 3.5.21 …. my newly…extra created for you…. Google Feed looks ok for Field Mapping: “product description (description) – product description”.

    Here´s my video: https://www.loom.com/share/ccdcd02d30094fc18022635149c147f1

    And I just realized using the Google Feed with Field Mapping: “product description (description) – product description parent product” contains tags such as <li>, <strong> etc. too.

    The problems seems to be using value “product description parent product” regardless of whether using Google Feed or Meta Feed.

    This must therefore be taken into account. Your video and your code is based on using value: product description. But I´m using value: product description parent product within Meta + Google Feed.

    Regards

    Plugin Support Jeff Alvarez

    (@superlemon1998)

    Hi @golfball-uhu,

    The snippet I’ve provided should work with all types of feed or marketplace.

    See video here: https://www.loom.com/share/635d39c2ec34433fa3e7c19c47fdb3cb

    But looking at your video, you are using product parent description; The code I’ve provide only works with description and short_description

    Here’s an updated code that targets all description field mappings:

    function storefront_pfp_strip_description_formatting( $product_data, $feed, $product ) {
    $description_keys = array(
    'description',
    'short_description',
    'raw_description',
    'raw_short_description',
    'mother_description',
    'mother_short_description',
    'variation_description',
    'variation_short_description',
    'raw_parent_description',
    'raw_parent_short_description',
    'raw_variation_description',
    'raw_variation_short_description',
    );
    foreach ( $description_keys as $key ) {
    if ( ! empty( $product_data[ $key ] ) && is_string( $product_data[ $key ] ) ) {
    $product_data[ $key ] = wp_strip_all_tags( $product_data[ $key ] );
    $product_data[ $key ] = preg_replace( '/\s+/', ' ', $product_data[ $key ] );
    $product_data[ $key ] = trim( $product_data[ $key ] );
    }
    }
    return $product_data;
    }
    add_filter( 'adt_get_product_data', 'storefront_pfp_strip_description_formatting', 5, 3 );

    Test it out and it should work now – when added refresh the feed and view the feed via incognito to verify the changes.

    Thread Starter golfball-uhu

    (@golfball-uhu)

    Hi Jeff,

    first tests are a success. I´ll keep you posted.

    Regards

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.