Skip to content

Instantly share code, notes, and snippets.

@leewillis77
Created June 19, 2019 13:02
Show Gist options
  • Save leewillis77/6e506b6dae5def37cea98f225b43d8a7 to your computer and use it in GitHub Desktop.
Save leewillis77/6e506b6dae5def37cea98f225b43d8a7 to your computer and use it in GitHub Desktop.
Hardcode price for all items in Google Product Fee
<?php
add_filter( 'woocommerce_gpf_feed_item_google', function ( $feed_item, $product ) {
// The regular price of the item.
$feed_item->regular_price_ex_tax = 1000;
$feed_item->regular_price_inc_tax = 1200;
// Set these to NULL if no sale price, or the sale price if required.
$feed_item->sale_price_ex_tax = null;
$feed_item->sale_price_inc_tax = null;
// Set these to the sale price if it exists, otherwise the regular price.
$feed_item->price_ex_tax = 1000;
$feed_item->price_inc_tax = 1200;
return $feed_item;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment