Sometimes you’ll want to add additional information to the URLs that your site submits to Google Merchant Centre. This can be important because you want to track the URLs – or have the page jump to relevant information for users coming through product ads.

There are filters in the plugin that allow you to alter the information that is used for any particular product. The simple example below adds a query argument of “queryArg” with a value of “myValue” to all product URLs.

function lw_woocommerce_gpf_feed_item_google( $feed_item ) {
    $feed_item->purchase_link = add_query_arg(
        array( 'queryArg' => 'myValue' ),
        $feed_item->purchase_link
    );
    return $feed_item;
}
add_filter( 'woocommerce_gpf_feed_item_google', 'lw_woocommerce_gpf_feed_item_google' );

This entry was posted in .
Bookmark the permalink.