Last active
April 21, 2020 08:17
-
-
Save leewillis77/9b93fbd4fd38d8026afc1b828b485d16 to your computer and use it in GitHub Desktop.
Set custom label 1 same as title 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) { | |
if (!empty($feed_item->title) && empty($feed_item->additional_elements['custom_label_1'])) { | |
$feed_item->additional_elements['custom_label_1'] = [ $feed_item->title ]; | |
} | |
return $feed_item; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment