0

I'm trying to implement Google Trusted Stores on my Expression Engine site using Expresso Store addon.

I was able to get the GTS Badge code/part to work, however I can't get the 2nd code/part to work. Here is an example of Google's code:

<!-- START Google Trusted Stores Order -->
<div id="gts-order" style="display:none;" translate="no">

  <!-- start order and merchant information -->
  <span id="gts-o-id">MERCHANT_ORDER_ID</span>
  <span id="gts-o-email">CUSTOMER_EMAIL</span>
  <span id="gts-o-country">CUSTOMER_COUNTRY</span>
  <span id="gts-o-currency">CURRENCY</span>
  <span id="gts-o-total">ORDER_TOTAL</span>
  <span id="gts-o-discounts">ORDER_DISCOUNTS</span>
  <span id="gts-o-shipping-total">ORDER_SHIPPING</span>
  <span id="gts-o-tax-total">ORDER_TAX</span>
  <span id="gts-o-est-ship-date">ORDER_EST_SHIP_DATE</span>
  <span id="gts-o-est-delivery-date">ORDER_EST_DELIVERY_DATE</span>
  <span id="gts-o-has-preorder">HAS_BACKORDER_PREORDER</span>
  <span id="gts-o-has-digital">HAS_DIGITAL_GOODS</span>
  <!-- end order and merchant information -->

  <!-- start repeated item specific information -->
  <!-- item example: this area repeated for each item in the order -->
  <span class="gts-item">
    <span class="gts-i-name">ITEM_NAME</span>
    <span class="gts-i-price">ITEM_PRICE</span>
    <span class="gts-i-quantity">ITEM_QUANTITY</span>
    <span class="gts-i-prodsearch-id">ITEM_GOOGLE_SHOPPING_ID</span>
    <span class="gts-i-prodsearch-store-id">ITEM_GOOGLE_SHOPPING_ACCOUNT_ID</span>
  </span>
  <!-- end item 1 example -->
  <!-- end repeated item specific information -->

</div>
<!-- END Google Trusted Stores Order -->

My question is, how do I pulled the customer email, customer country, etc details into the script. I tried using the Expresso Store tags for the data {order_total} etc, but that didn't work. I also tried that again after placing the Google script inside of my {exp: expresso store loop.

Using EE 2.8.1 and Expresso Store is up-to-date.

Thanks in advance!!

0

This code is on your order success page right? If so the information will be available within your

{exp:store:orders order_hash="{segment_xx}"}
  order info is all here
{/exp:store:orders}

loop

For example:

{exp:store:orders order_hash="{segment_3}"}
  <span id="gts-o-email">{order_email}</span>
  <span id="gts-o-country">{billing_country_name}</span>
<!-- now show each cart line -->
{items}
  <span class="gts-i-name">{title}</span>
  <span class="gts-i-price">{item_subtotal}</span>
  <span class="gts-i-quantity">{item_qty}</span>
{/items}
{/exp:store:orders}

Remember, if you want currency values that are not pre-formatted, just add _val to the end of each variable for a pure number i.e.

{item_subtotal} becomes {item_subtotal_val}
| improve this answer | |
  • Thank you Jos. When I originally tested this, I had Google's Code inside a template and embedded that on the order confirmation page. So, I wonder if the parsing had something to do with it not working the first time. So,can I use the ExpressionEngine tags to pull the data: <!-- START Google Trusted Stores Order --> <div id="gts-order" style="display:none;" translate="no"> <!-- start order and merchant information --> <span id="gts-o-id">MERCHANT_ORDER_ID</span> <span id="gts-o-email">{order_email}</span> – db123 Sep 22 '16 at 13:32
  • Embeds are parsed fairly late on so it's possible the variables had already been written out by the time the embed was included. Try using a snippet instead - these are parsed very early on and might aswell be considered as being part of the page. Make sure the Google code is inside the {exp:store:orders order_hash="{segment_xx}"} tag pair and that you've replaced the elements in CAPS with the appropriate Store code (like I showed in the example) – Jos Medinger Sep 22 '16 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.