Created
July 31, 2020 07:49
-
-
Save leewillis77/9a834053773b92fac8d717387aa42173 to your computer and use it in GitHub Desktop.
Add sale status to custom label in 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 | |
add_filter( 'woocommerce_gpf_feed_item_google', function ( $feed_item, $wc_product ) { | |
$feed_item->additional_elements['custom_label_4'] = [ | |
$wc_product->is_on_sale() ? 'On Sale' : '' | |
]; | |
return $feed_item; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment