Skip to content

Commit

Permalink
fix looping errors (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
tekhaus committed Sep 17, 2024
1 parent b5bf9cb commit e8f78f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@
}
{% endcapture %}

{% assign result = query | shopify %}
{% assign variants_result = query | shopify %}

{% if event.preview %}
{% capture result_json %}
{% capture variants_result_json %}
{
"data": {
"product": {
Expand All @@ -314,18 +314,18 @@
}
{% endcapture %}

{% assign result = result_json | parse_json %}
{% assign variants_result = variants_result_json | parse_json %}
{% endif %}

{% for variant in result.data.product.variants.nodes %}
{% for variant in variants_result.data.product.variants.nodes %}
{% if variant.inventoryPolicy == "CONTINUE" or variant.inventoryQuantity > 0 %}
{% assign has_in_stock_variant = true %}
{% break %}
{% endif %}
{% endfor %}

{% if result.data.products.variants.pageInfo.hasNextPage and has_in_stock_variant != true %}
{% assign variants_cursor = result.data.products.variants.pageInfo.endCursor %}
{% if variants_result.data.product.variants.pageInfo.hasNextPage and has_in_stock_variant != true %}
{% assign variants_cursor = variants_result.data.product.variants.pageInfo.endCursor %}
{% else %}
{% break %}
{% endif %}
Expand Down
Loading

0 comments on commit e8f78f6

Please sign in to comment.