shopify product call on instapage landing page

shopify product call on instapage landing page

Kumar2573
Shopify Partner
171 8 21

<amp-script width="500" height="700" script="hello-world">
<div id="products_call"></div>
</amp-script>
<!-- Add [target="amp-script"] to the <script> element. -->
<script id="hello-world" type="text/plain" target="amp-script">

fetch('api url')
.then(response => response.json())
.then(function(data){
var comp_price = '';
if(data.product.variants[0].compare_at_price != ''){
comp_price = '$' + data.product.variants[0].compare_at_price;
}
var prod_data = `<div class="prd_main">
<div class="prd_iner">
<div class="prd_img">
<amp-img src="${data.product.image.src}" alt="product main image" width="100" height="100" layout="responsive"></amp-img >
</div>
<div class="prd_meta">
<p class="title">${data.product.title}</p>
<div class="prd_price">
<span class="price">$ ${data.product.variants[0].price}</span>
<span class="comp_price"><del> ${comp_price} </del></span>
</div>
<div class="prd_action">

<a href="url/cart/${data.product.variants[0].id}:1?checkout" class="btn" id="shopclick"> Shop Now</a>

</div>
</div>
</div>
</div>`;

document.getElementById('products_call').innerHTML=prod_data;

})

</script>

Shopify Certified Developer Profile - https://www.credly.com/badges/1733d05c-2a88-490a-aef5-b01baf3b94ce/public_url
Expert Shopify Plus & shopify Developer & Theme customizer
- If the problem is solved remember to click to Accept Solution
- Press Like ?? if the answer was helpful
- Still, Facing issue, Reach out to me Email :- jitendra3496@gmail.com | Skype :- jitendra2573_1
- Direct Hire me :- Direct Contact me
Replies 0 (0)