How to speed up showing product on storefront, when it has many variations

Product page on Storefront might be loading too slowly because of all the bulky data that is has. Only the required information in each particular situation should be loaded.
Increasing the performance for product with tens (or thousands) of variations:

  • Don’t load the variations at all. You can control this by ItemResponseGroup.
    Calling the load product API with response group without Variations flag:
IItemService.GetById(id, ItemResponseGroup.Full & ~ItemResponseGroup.Variations)

This can be set in theme (Liquid template) as well:

{% paginate collection.products by 5 params {"ResponseGroup":"Manually set the exact product dependencies to be loaded on this page. E.g., 'ItemInfo'"} %}
   {% for product in collection.products%}
     ....
   {% endfor %}
{% endpaginate %}