Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@joe-dempsey
Created October 9, 2017 11:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joe-dempsey/4ed55937b7292907e90eae05d830b2ff to your computer and use it in GitHub Desktop.
Save joe-dempsey/4ed55937b7292907e90eae05d830b2ff to your computer and use it in GitHub Desktop.
Google code for reviews shopify checkout
<code>
{% if customer.default_address.country | json == 'United Kingdom' %}
{% comment %}
Delivery may take up to 7 days in this case so we're doing date + 7 days and assigning it.
{% endcomment %}
{% assign seconds = 7 | times: 24 | times: 60 | times: 60 %}
<script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script>
<script>
window.renderOptIn = function() {
window.gapi.load('surveyoptin', function() {
window.gapi.surveyoptin.render(
{
// REQUIRED
"merchant_id": enter your merchant id here,
"order_id": "{{ order.id }}",
"email": "{{ customer.email }}",
"delivery_country": "GB",
"estimated_delivery_date": "{{ "now" | date: "%s" | plus: seconds | date: "%Y-%m-%d" }}",
// OPTIONAL
"opt_in_style": "CENTRE_DIALOG"
});
});
}
</script>
{% endif %}
</code>
@joe-dempsey
Copy link
Author

joe-dempsey commented Jun 17, 2018

Google shopping reviews for Shopify. This example uses the UK only as the delivery country & an estimated delivery time of 7 days.

Things you need to edit:
delivery_country
estimated_delivery_date

It then needs to go in your checkout additional scripts section and paste there.

@kmeanskeshav
Copy link

do i have to make shopify-reviews.liquid or just add in checkout page

@kmeanskeshav
Copy link

PLEASE HELP

@kmeanskeshav
Copy link

how will i know that code is working or not

@joe-dempsey
Copy link
Author

you'll know if you go to order status page - you will see popup and can inspect console etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment