bigcartel

How to fetch product image urls on a product page?


I'm building a custom theme for my bigcartel store. Trying to implement a share button, and I would like to insert the first image's URL into the share control. How do I access the first image only? Thank you!!


Solution

  • When on the Product page, or whenever you have a product variable available to you - you can retrieve the first image using:

    {{ product.image | product_image_url }}

    Also documented here:

    https://developers.bigcartel.com/api/themes#product

    product.image   Returns the default image of a product.
    product.images  Returns all of the images of a product.
    product.image_count Returns the number of images a product has