Skip to content

Instantly share code, notes, and snippets.

@AbWahab07
Created May 4, 2020 10:03
Show Gist options
  • Select an option

  • Save AbWahab07/f0a4b5ab880a5cac30afb5851a6ff85d to your computer and use it in GitHub Desktop.

Select an option

Save AbWahab07/f0a4b5ab880a5cac30afb5851a6ff85d to your computer and use it in GitHub Desktop.

Revisions

  1. AbWahab07 created this gist May 4, 2020.
    50 changes: 50 additions & 0 deletions product-json.liquid
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    <script id="product-json-{{ product.id }}" class="product-json" type="application/json">
    {
    "id": {{ product.id | json }},
    "title": {{ product.title | json }},
    "handle": {{ product.handle | json }},
    "description": {{ product.description | json }},
    "vendor": {{ product.vendor | json }},
    "type": {{ product.type | json }},
    "tags": {{ product.tags | json }},
    "price": {{ product.price | json }},
    "price_min": {{ product.price_min | json }},
    "price_max": {{ product.price_max | json }},
    "available": {{ product.available | json }},
    "price_varies": {{ product.price_varies | json }},
    "compare_at_price_min": {{ product.compare_at_price_min | json }},
    "compare_at_price_max": {{ product.compare_at_price_max | json }},
    "compare_at_price_varies": {{ product.compare_at_price_varies | json }},
    "variants": [{% for variant in product.variants %}
    {
    "id": {{ variant.id | json }},
    "title": {{ variant.title | json }},
    "option1": {{ variant.option1 | json }},
    "option2": {{ variant.option2 | json }},
    "option3": {{ variant.option3 | json }},
    "featured_image": {
    "id": {{ variant.image.id | json }},
    "product_id": {{ variant.image.id | json }},
    "position": {{ variant.image.position | json }},
    "alt": {{ variant.image.alt | json }},
    "width": {{ variant.image.width | json }},
    "height": {{ variant.image.height | json }},
    "src": {{ variant.image.src | json }}
    },
    "available": {{ variant.available | json }},
    "price": {{ variant.price | json }},
    "compare_at_price": {{ variant.compare_at_price | json }},
    "inventory_management": {{ variant.inventory_management |json }},
    "inventory_quantity": {{ variant.inventory_quantity | json }},
    "sku": {{ variant.sku | json }},
    "weight": {{ variant.weight | json }},
    "weight_unit": {{ variant.weight_unit | json }},
    "weight_in_unit": {{ variant.weight_in_unit | json }}
    }{% unless forloop.last %},{% endunless %}
    {% endfor %}],
    "images": {{ product.images | json }},
    "featured_image": {{ product.featured_image | json }},
    "options": {{ product.options | json }},
    "url": {{ product.url | json }}
    }
    </script>