The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Google Customer Reviews


We're just reviewing integrating Google product reviews with our website and wondered whether any FoxyCart users had already succesfully completed the integration, aka:

Many thanks
  • fc_marijafc_marija FoxyCart Team
    hi @BLJ -

    We've recently had a user working on this integration, but I'm not sure if they've implemented it. If you want to try it out, we can give you some direction based upon that discussion with them.

    You'll want to paste the JS code into your configuration custom footer as shown below. I've included a few notes within the code for clarification, and inserted the values you'll need from the cart.

    {% if first_receipt_display %}

    <!-- BEGIN GCR Opt-in Module Code -->
    <script src=""
    async defer>

    window.renderOptIn = function() {
    window.gapi.load('surveyoptin', function() {
    "merchant_id":"MERCHANT_ID", //You'll need to get from your Google Merchant Centre account
    "order_id": {{ transaction_id }},
    "email": {{ customer_email }},
    "delivery_country": {{ }},
    "estimated_delivery_date": "YYYY-MM-DD", //see below

    "opt_in_style": "OPT_IN_STYLE"
    <!-- END GCR Opt-in Module Code -->

    <!-- BEGIN GCR Language Code -->
    window.___gcfg = {
    lang: 'en_GB' //your default language here
    <!-- END GCR Language Code -->

    {% endif %}

    Currently FoxyCart doesn't have an estimated delivery date value for the transaction - we don't track that information yet. One approach you could take is to alter the date of the checkout ahead an average delivery time. Depending on your set up - you could potentially get more complex and have a specific estimated length of time based on the state too.

    As an example of how you would modify the transaction date:

    {{ checkout_date|date_modify("+7 day")|date("Y-m-d") }}

    That Twig code would output a date in the YYYY-MM-DD format, but 7 days ahead of the date that the checkout occurred on. So if the checkout happened on the 11th of October, that date would be 2017-10-18.

    Hope that gets you started if you decide to use it.
  • PhilippePhilippe Member
    edited September 2018
    I will try this tomorrow - I have a question though, regarding the language - our cart functions in multiple language so what is the {{ code for language goes here }} parameter I need to use to replace the hardcoded language in the snippet you offered above ?

    window.___gcfg = {
    lang: 'en_GB' //your default language here

    We use english, French, Spanish and Italian, and google expects those language codes to be provided in the following formats:


    (I am not clear why they use 5 digits code for variations of English - but just 2 letter codes for the others ?)
  • fc_adamfc_adam FoxyCart Team

    Good question. You could get that by working out what template set the customer is utilising for their transaction. For example:

    {% set locale = "en_US" %}
    {% if template_set == "au" %}
    {% set locale = "en_AU" %}
    {% elseif template_set == "gb" %}
    {% set locale = "en_GB" %}
    {% elseif template_set == "es" %}
    {% set locale = "es" %}
    {% elseif template_set == "fr" %}
    {% set locale = "fr" %}
    {% elseif template_set == "it" %}
    {% set locale = "it" %}
    {% endif %}
    You'll need to update that to have the correct codes for your template sets, but if you insert that before you need to output the locale code, you can then use {{ locale }} to output the locale code in the config.
  • Adam,

    Has tea above code been tested ? When I install it , as discussed above, it breaks a nubmer of items including the sidecars and triggers emails as below:

    An error was recently triggered for one of the templates for your store, iSails. There may be a fatal error in a twig template related to that page which will need to be corrected, otherwise customers may not be able to complete transactions for your store.

    To correct this error, the first step is to recache and save your templates (including category and email templates) and test your store to ensure pages are displaying as they should. If the error persists, you will need to take a closer look at your templates to see what might be causing issues. If you're working with a developer for your store, it might be worth reaching out to them to ask them to assist you in debugging your templates. Also, you might find some additional information about this error from your stores error log available from your stores FoxyCart administration.

    Don't hesitate to get in touch with our support either by email or through the forums if you have any questions about why a specific template might be causing this error.

    - The FoxyCart Team
  • fc_adamfc_adam FoxyCart Team

    Interesting - I tested it on my own store and it worked as expected. Could you paste in the code you are using within your store and confirm where you're pasting it? If you'd prefer to keep your customisations private, you can whisper them to me using the "whisper" checkbox and entering my name in the text input that appears.
Sign In or Register to comment.