Skip to content

Instantly share code, notes, and snippets.

@leewillis77
Last active June 4, 2020 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leewillis77/8e299bf840bbdef2aad8aca51fda3a9d to your computer and use it in GitHub Desktop.
Save leewillis77/8e299bf840bbdef2aad8aca51fda3a9d to your computer and use it in GitHub Desktop.
Example of adding fixed g:shipping tag to Google Product Feed
<?php
add_filter( 'woocommerce_gpf_feed_item_google', function ( $feed_item, $wc_product ) {
$feed_item->additional_elements['shipping'] = [
[
'country' => 'GB',
'region' => 'Cumbria',
'service' => 'Royal Mail',
'price' => '1.99 GBP',
]
];
return $feed_item;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment