Advertisement
dwikharisma

Untitled

Aug 3rd, 2021
1,312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="application/ld+json">
  2. {
  3.   "@context": "http://schema.org/",
  4.   "@type": "IndividualProduct",
  5.   "name": "{{ product.title | escape }}",
  6.   "url": "{{ shop.url }}{{ product.url }}",
  7.   {%- if product.variants.first.sku != blank -%}
  8.   "sku": "{{ product.variants.first.sku }}",
  9.    {%- endif -%}
  10.    
  11. {% if product.variants.first.barcode.size == 13 %} "gtin13": {{ product.first_available_variant.barcode }}, {% endif %}  
  12.    
  13.   {%- if product.featured_image -%}
  14.     {%- assign image_size = product.featured_image.width | append: 'x' -%}
  15.     "image": [
  16.       "https:{{ product.featured_image.src | img_url: image_size }}"
  17.     ],
  18.   {%- endif -%}
  19.   {%- if current_variant.sku != blank -%}
  20.     "sku": "{{ current_variant.sku }}",
  21.   {%- endif -%}
  22.   "brand": {
  23.     "@type": "Thing",
  24.     "name": "{{ product.vendor | escape }}"
  25.   },
  26.   "offers": [
  27.     {%- for variant in product.variants -%}
  28.       {
  29.         "@type" : "Offer",
  30.         {%- if variant.sku != blank -%}
  31.           "sku": "{{ variant.sku }}",
  32.         {%- endif -%}
  33.         "availability" : "http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}",
  34.         "price" : "{{ variant.price | divided_by: 100.00 }}",
  35.         "priceCurrency" : "{{ cart.currency.iso_code }}",
  36.         "url" : "{{ shop.url }}{{ variant.url }}"
  37.       }{% unless forloop.last %},{% endunless %}
  38.     {%- endfor -%}
  39.   ],
  40.   "description": "{{ product.description | strip_html | escape | strip | strip_newlines }}"
  41. }
  42. </script>
  43.  
  44. <script type="application/ld+json">
  45. {
  46.   "@context": "https://schema.org",
  47.   "@id": "#product",
  48.   "@type": "SomeProducts",
  49.   "additionalType": "{{ shop.url }}{{ product.url }}",
  50.   "description": "{{ product.description | strip_html | escape | strip | strip_newlines }}",
  51.   "name": "{{ product.title | escape }}"
  52. }
  53. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement