简体   繁体   中英

Shopify - Heavy Liquid Loop

I'd like to know if this type of loop would cause performance problems. It would happen in a product grid.

(not the correct syntax, but shows my thought process)

for product in shop.all-products
    for tag in product.all-tags
        if tag contains 'string'
            show product

I'm asking for a shop that currently has about 500 products and each product may have up to about ten tags. So this would loop through all products in the store and all tags in each product.

It's handled server-side, so I'm also wondering if the HTML output is cached so that the Liquid won't need to run every time?

Thanks

It will cause an overload on the system.

You can achieve this using a custom collection template with product fields listed in json and AJAX

You can use the idea implemented in this - https://help.shopify.com/themes/customization/store/enable-autocomplete-for-search-boxes

New tutorial with new features from Shopify - https://help.shopify.com/en/themes/development/predictive-search

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM