Fixing the WooCommerce Product Feed description

After fixing the description in the XML file created by the WooCommerce Google Product Feed plugin we decided to share our solution. The problem was with the product feed description being set as HTML code instead of plain text which makes it unreadable.

Product Feed Description BEFORE being fixed

Fixing the product feed description was surprisingly simple and easy to do. First of all, access your WordPress website’s directory using FTP. Next, navigate to wp-content/plugins/woocommerce-product-feeds/woocommerce-gpf-feed-item.php. Open that file and scroll down to the function “get_product_description()” near line 434. Go to the end of the function, comment out the return statement, and replace it with the following PHP code.

	...
	// Comment out the original return statement
	/*
	return apply_filters(
		'the_content',
		$description
	);
	*/
	
	return ($description);	// Return the plain text description

Finally, save your changes.
After saving your code and reloading your XML file your description should appear just like it ought to.
Product Feed Description AFTER being fixed

So why does this work? The original return statement called the function “apply_filters()”. However, this takes the plain text description and formats it to be displayed as HTML code on the website (apply_filters(‘the_content’, string $content)). (Hence why it originally showed the HTML code as the product feed description.) But the Google Merchant Center only wants the plain text description. So we skipped over the function that formats the description for the website and directly returned the plain text of the description.

Sign up to get our latest articles

Don’t worry. We won’t sell your email. We are also really busy managing our clients, so we won’t be filling your inbox with articles every day. We only write them when we have a compelling reason to do so, and some spare time too!

preloader