Search code examples
google-schemas

Order schema not showing right on Gmail


I'm trying to implement the Order schema as presented on : https://developers.google.com/gmail/markup/reference/order

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Order",
  "merchant": {
    "@type": "Organization",
    "name": "Test Ltd."
  },
  "orderNumber": "56d59b633427b",
  "orderStatus": "http://schema.org/PaymentComplete",
  "acceptedOffer": {
    "@type": "Offer",
    "itemOffered": {
      "@type": "Product",
      "name": "Test Products"
    },
    "price": "41.09",
    "priceCurrency": "USD",
    "eligibleQuantity": {
      "@type": "QuantitativeValue",
      "value": "1"
    },
    "url": "http://project1.local/account/tickets",
    "potentialAction": {
      "@type": "ViewAction",
      "target": "http://project1.local/account/tickets"
    }
  }}
</script>

The issue is that the email shows like a normal email. What am I doing wrong?

Thank you!

PS: The code validates on https://developers.google.com/structured-data/testing-tool/


Solution

  • Try using the JSON I've posted below. PaymentComplete is not recognized, so I used OrderDelivered. You can find more info here:

    https://schema.org/OrderStatus

    I noticed the word "tickets" in your URL, are you intending to use the order schema for ticket confirmations? I would suggest using event reservation instead. Using this will integrate with Google Now cards and also input the event into the user's Calendar. You can still generate a action button by using url or modifyReservationurl.

    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "Order",
      "merchant": {
        "@type": "Organization",
        "name": "Test Ltd."
      },
      "orderNumber": "56d59b633427b",
      "orderStatus": "http://schema.org/OrderDelivered",
      "priceCurrency": "USD",
      "price": "41.00",
      "acceptedOffer": {
        "@type": "Offer",
        "itemOffered": {
          "@type": "Product",
          "name": "Test Products"
        },
        "price": "41.00",
        "priceCurrency": "USD",
        "eligibleQuantity": {
          "@type": "QuantitativeValue",
          "value": "1"
        }
      },
      "url": "https://project1.local/account/tickets",
      "potentialAction": {
        "@type": "ViewAction",
        "target": "https://project1.local/account/tickets"
      }
    }
    </script>

    enter image description here