Skip to content

Instantly share code, notes, and snippets.

@rynaldos-zz
Last active February 3, 2017 08:24
Show Gist options
  • Save rynaldos-zz/ea421f94c3bda771a375af34f90438b9 to your computer and use it in GitHub Desktop.
Save rynaldos-zz/ea421f94c3bda771a375af34f90438b9 to your computer and use it in GitHub Desktop.
[WooCommerce] Adds the Google store badge
add_action( 'woocommerce_google_badge', 'my_google_badge' );
function my_google_badge() {
?>
<!-- BEGIN: Google Trusted Store -->
<script type="text/javascript">
var gts = gts || [];
gts.push(["id", "54785"]);
gts.push(["google_base_offer_id", "ITEM_PRODUCT_SEARCH_ID"]);
gts.push(["google_base_subaccount_id", "ITEM_PRODUCT_SEARCH_ACCOUNT_ID"]);
gts.push(["google_base_country", "ITEM_PRODUCT_SEARCH_COUNTRY"]);
gts.push(["google_base_language", "ITEM_PRODUCT_SEARCH_LANGUAGE"]);
(function() {
var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
var gts = document.createElement("script");
gts.type = "text/javascript";
gts.async = true;
gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(gts, s);
})();
</script>
<!-- END: Google Trusted Store -->
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment