Last active
June 4, 2020 07:54
-
-
Save leewillis77/59aa17a83d230331a01753aabd7b4da2 to your computer and use it in GitHub Desktop.
How to modify price of items in the Google Product Feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function lw_woocommerce_gpf_feed_item_google( $feed_item, $product ) { | |
// If you need to modify the prices sent in the feed, you can modify the following | |
// properties of the feed_item object. | |
// The regular price of the item. | |
// $feed_item->regular_price_ex_tax | |
// $feed_item->regular_price_inc_tax | |
// The sale price of the item. Set to/leave as NULL if not required. | |
// $feed_item->sale_price_ex_tax | |
// $feed_item->sale_price_inc_tax | |
// Set these to the sale price if it exists, otherwise the regular price. | |
// $feed_item->price_ex_tax | |
// $feed_item->price_inc_tax | |
return $feed_item; | |
} | |
add_filter( 'woocommerce_gpf_feed_item_google', 'lw_woocommerce_gpf_feed_item_google', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment