Google Product Feed – Customizations

Note: This is a Developer level section. If you are unfamiliar with code and resolving potential conflicts, select a WooExpert or Codable for assistance. We are unable to provide support for customizations under our  Support Policy.

Use the short product description instead of description ↑ Back to top

If you’re using version 7.8.0 or higher, then the plugin provides options for choosing how to create the description in the feed. The correct option to choose will depend on how you’ve populated your product data.

The full list of available options is shown in the screenshot below:

The default option for new setups is “Main product description (full preferred) plus variation description“. For stores coming from older versions of the extension, they will be set to “Variation description only, fallback to main description (full preferred)” which matches the previous behaviour of the plugin.

If you’re on an older version of the plugin then you can use one of the snippets below to customise the description, although we’d recommend upgrading to version 7.8.0 or higher and using the built in options as above.

If you’re using WooCommerce 3.0 or higher, use this snippet:

For WooCommerce 2.6.x or lower, use this snippet:

If you need to completely customise the description used in the feed you can use the snippet below:

Populate the feed with custom values ↑ Back to top

You can add or override any element value with one of your own using the filters in the plugin. Here’s an example of populating the “brand” element from a custom field called supplier_brand_name:

Exclude categories from the feed ↑ Back to top

This snippet shows how to exclude products in a certain category (category ID 21) from the feed:

Change the image size used in the feed

By default, the feed uses the “full” image style. If you want to send an alternative image size, you can adapt this snippet to change the image size used to any of the registered image sizes. This example sets it to the “shop_catalog” image size.

Disable additional images from being included ↑ Back to top

The following snippet will cause only the single, main product image to be sent in the feed.

Register custom field for pre-population

The pre-population options in the extension do not include “hidden” meta, or custom fields by default. If you want to make a custom field available as a pre-population option then you can use the following snippet, simply replace “_my_custom_field” with the field name of your custom field.

Remove shipping weight from feed ↑ Back to top

If you want to remove the shipping weight from the feed you can do so with the following snippet:

Remove shipping dimensions from feed ↑ Back to top

The following snippet can be used to remove all shipping dimensions (length, width and height) from products in the feed:

Hide attribute labels on variable product titles ↑ Back to top

When generating feed items for variable products, the extension generates unique titles for each variation by including attribute information in the feed title as per Google’s requirements. For example, a “Widget” available in 2 different colors and sizes might have its four items listed as:

  • Widget (Size: Small, Color: Light)
  • Widget (Size: Small, Color: Dark)
  • Widget (Size: Large, Color: Light)
  • Widget (Size: Large, Color: Dark)

If you have many attributes, or complex attribute names on your variable products then this may generate overly long item titles. The extension will allow you to drop the attribute name (“Size” and “Color” in the previous example). This would generate titles like this:

  • Widget (Small, Light)
  • Widget (Small, Dark)
  • Widget (Large, Light)
  • Widget (Large, Dark)

To enable this behaviour use the following snippet:

Modifying the title used in the feed ↑ Back to top

Note: Google’s official guidance is that the product title sent in the feed should match the title on the product page itself. If you change it to something different then you may get disapprovals in Google Merchant Centre for your products. The plugin doesn’t include any way out-of-the-box to modify the title used in the feed because of that.

If you do want to modify the title used in the feed, then the following code snippet shows how you can use a filter to do so.

Modifying the ID generated in the feed ↑ Back to top

The extension automatically generates a unique ID for every product in the feed that meets Google’s requirements for IDs. If you need to change this then you can do so with the following snippet, although we do not recommend this.

However: Changing the ID is not recommended as the value you choose for it must meet strict requirements including that it should be unique, and non-changing over time. As such values such as the SKU, or MPN aren’t recommended.

Note: Changing the ID format for an existing feed will result in duplicate products being created, with the new version requiring approval and validation before they can be used for product ads.

If you do still wish to change the ID, then the following snippet shows the filter you can use:

Questions & Feedback ↑ Back to top

Have a question before you buy? Please fill out this pre-sales form.

Already purchased and need some assistance? Open a support ticket via the Help Desk.

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top