[Liquid]商品ハンドルから商品オブジェクト取得
all_productsは最大20件の商品情報しか保持しないため、コレクションを使用する必要がある。
予め全商品を含みコレクションハンドル「created-descending」のコレクションを作成しておく
function_get_product_by_handle.liquid
{%- assign get_product_by_handle = nil -%} {%- paginate collections['created-descending'].products by collections['created-descending'].all_products_count -%} {%- for model_product in collections['created-descending'].products -%} {%- if model_product.handle == target_handle -%} {%- assign product = model_product -%} {%- break -%} {%- endif -%} {%- endfor -%} {%- endpaginate -%}