Created
October 9, 2017 11:52
-
-
Save joe-dempsey/4ed55937b7292907e90eae05d830b2ff to your computer and use it in GitHub Desktop.
Google code for reviews shopify checkout
This file contains 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
<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> |
do i have to make shopify-reviews.liquid or just add in checkout page
PLEASE HELP
how will i know that code is working or not
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
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.