Why aren't products appearing in my cart without refreshing?

Topic summary

A Shopify store owner encountered an issue where products added to the cart weren’t displaying until the page was manually refreshed.

Initial Problem:

  • Products successfully added to cart but not visible without page refresh
  • Issue occurred on collection pages with PageFly customizations

Troubleshooting Steps:

  • PageFly support (Victor) initially requested code insertion before the </body> tag in theme.liquid
  • User couldn’t locate the body tag and shared their full theme.liquid code
  • Code appeared reversed/corrupted in the shared snippet, complicating diagnosis

Resolution:

  • Victor directly accessed and fixed the issue on the PageFly end
  • Problem resolved without requiring manual code changes from the store owner
  • Cart now displays added products immediately without refresh

The issue was related to PageFly’s integration with the Shopify theme and required backend adjustments by PageFly support rather than theme code modifications.

Summarized with AI on November 23. AI used: claude-sonnet-4-5-20250929.

Added products to cart, will not show, as before, in the cart unless I refresh, and it will appear

Thanks you

Allianceautoproducts.com

Hi @Alliance,

You can try this code by following these steps:

Step 1: Go to Online Store->Theme->Edit code.

Step 2: Search file theme.liquid,

Step 3: Paste the below code at before element of the file → Save


If it doesn’t work, please let me know. Because this matter is related PageFly app you also can chat with our 24/7 live chat to get real-time support and solve it quickly.

Hope my solution works perfectly for you!

Best regards,

Victor | PageFly

Hi victor,

I can’t see any body tage there. Here is theme.liquid full code, please adivce.

{% render 'pagefly-head' %} {% if request.path contains 'the-2021-agenda' %} body { background-image: url({{ 'image-name-with-extension' | asset_img_url: 'original' }}); background-repeat: no-repeat; background-size: cover; } {% endif %}

{%- if settings.favicon != blank -%}

{%- endif -%}

{%- capture seo_title -%}
{%- if request.page_type == ‘search’ and search.performed == true -%}
{{ ‘general.search.heading’ | t: count: search.results_count }}: {{ ‘general.search.results_with_count’ | t: terms: search.terms, count: search.results_count }}
{%- else -%}
{{ page_title }}
{%- endif -%}
{%- if current_tags -%}
{%- assign meta_tags = current_tags | join: ', ’ -%} – {{ ‘general.meta.tags’ | t: tags: meta_tags -}}
{%- endif -%}
{%- if current_page != 1 -%}
– {{ ‘general.meta.page’ | t: page: current_page }}
{%- endif -%}
{%- assign escaped_page_title = page_title | escape -%}
{%- unless escaped_page_title contains shop.name -%}
– {{ shop.name }}
{%- endunless -%}
{%- endcapture -%}

{{ seo_title | strip }}

{%- if page_description -%}

{%- endif -%}

{% include ‘social-meta-tags’ %}

{{ ‘theme.scss.css’ | asset_url | stylesheet_tag }}
{{ ‘eboost.css’ | asset_url | stylesheet_tag }}

{%- if request.page_type contains ‘customers/’ -%}

{%- endif -%}

{% include “starapps-pg-meta” %}

{% include ‘meteor-menu’, load: ‘head’ %}
{{ content_for_header }}

{% assign is_wcp_wholesale_customer = false %}
{% assign active_discounts = shop.metafields.wcp_active_discounts.wcp_active_discounts %}
{% assign active_discounts_array = active_discounts | split: ‘,’ %}
{% if shop.metafields.wcp_status.wcp_status != ‘disabled’ and customer %}
{% for discount_key in active_discounts_array %}
{% assign key_split = discount_key | split: ‘-’ %}
{% assign key_split_length = key_split | size %}
{% if key_split_length > 2 %}
{% assign removeable_key = key_split.last | prepend: ‘-’ %}
{% assign wcp_hide_sale_badge_customer_tag = discount_key | remove_first: removeable_key %}
{% else %}
{% assign wcp_hide_sale_badge_customer_tag = key_split[0] %}
{% endif %}
{% if customer.tags contains wcp_hide_sale_badge_customer_tag %}
{% assign is_wcp_wholesale_customer = true %}
{% endif %}
{% endfor %}
{% endif %}
{% unless is_wcp_wholesale_customer == true %}
{%- render ‘bold-options-hybrid’ -%}
{%- render ‘bold-common’ -%}
{% endunless %}

{% if template == ‘product’ and product.metafields.inventory.ShappifyHidden or product.type contains ‘HIDDEN’ %}{% endif %}

{% include ‘gem-app-header-scripts’ %}

{% include ‘pagefly-header’ %}
{% render ‘weglot_hreftags’ %}
{% render ‘weglot_switcher’ %}

{% include ‘bss-product-labels-configs’ %}
{% if template == ‘cart’ %}{% include “revy-bundle-script” %}{% endif %}

{{ ‘general.accessibility.skip_to_content’ | t }}

{%- if settings.enable_ajax -%}
{% include ‘cart-popup’ %}
{%- endif -%}

{% section ‘header’ %}

{% if template contains ‘wholesale’ %}
{% if customer %}
{% if customer.tags contains ‘wholesale’ %}
{{ content_for_layout }}
{% else %}
{% include ‘wholesale-note’ %}
{% endif %}
{% else %}
{% include ‘wholesale-note’ %}
{% endif %}
{% else%}
{{ content_for_layout }}
{% endif %}

{% include “arp” %}

{% section ‘footer’ %}

{{- 'sections.slideshow.navigation_instructions' | t -}}
  • {{ 'general.accessibility.refresh_page' | t }}
  • {{ 'general.accessibility.selection_help' | t }}
{% include 'magisto' %} {% comment %}This is for Badge Master By Hulkapps{% endcomment %} {% include 'hulkcode_trustbadge' %} {% render 'hextom_usb_main', product: product, customer: customer %}

{% include ‘smile-initializer’ %}

{% include ‘gem-app-footer-scripts’ %}

{% assign wcp_wholesale_customer = false %}
{% assign active_discounts = shop.metafields.wcp_active_discounts.wcp_active_discounts %}
{% assign active_discounts_array = active_discounts | split: ‘,’ %}
{% if shop.metafields.wcp_status.wcp_status != ‘disabled’ and customer %}
{% for discount_key in active_discounts_array %}
{% assign key_split = discount_key | split: ‘-’ %}
{% assign key_split_length = key_split | size %}
{% if key_split_length > 2 %}
{% assign removeable_key = key_split.last | prepend: ‘-’ %}
{% assign wcp_customer_tag = discount_key | remove_first: removeable_key %}
{% else %}
{% assign wcp_customer_tag = key_split[0] %}
{% endif %}
{% if customer.tags contains wcp_customer_tag %}
{% assign wcp_wholesale_customer = true %}
{% endif %}
{% endfor %}
{% endif %}
{% if wcp_wholesale_customer == false %}
{% comment %}{%render ‘sc-wholesale-simplified’%}{% endcomment %}
{% endif %}

{% if customer.tags.size > 0 and template != ‘cart’ %}

{% endif %}

{% if customer.tags.size > 0 and template == ‘cart’ %}
{% include ‘wcp_cart’ %}
{% endif %}

{% if template contains ‘product’ %}

.your_section_selector{background-color: gray;}

{% endif %}

.section-header { margin-bottom: 50px !important; marging-top: 15px !important; } } .grid--view-items { text-align: center; margin-top: 63px !important; } h3{ font-weight: bolder !important; font-size: 14px !important; } h4{ font-weight: bolder !important; font-size: 28px !important; } h2 { font-weight: bolder !important; font-size: 28px !important; th, td { text-align: left !important; border: solid 1px #d6d4d4 !important; padding: 10px 14px !important; }

{% render 'pagefly-head' %} {% if request.path contains 'the-2021-agenda' %} body { background-image: url({{ 'image-name-with-extension' | asset_img_url: 'original' }}); background-repeat: no-repeat; background-size: cover; } {% endif %}

{%- if settings.favicon != blank -%}

{%- endif -%}

{%- capture seo_title -%}
{%- if request.page_type == ‘search’ and search.performed == true -%}
{{ ‘general.search.heading’ | t: count: search.results_count }}: {{ ‘general.search.results_with_count’ | t: terms: search.terms, count: search.results_count }}
{%- else -%}
{{ page_title }}
{%- endif -%}
{%- if current_tags -%}
{%- assign meta_tags = current_tags | join: ', ’ -%} – {{ ‘general.meta.tags’ | t: tags: meta_tags -}}
{%- endif -%}
{%- if current_page != 1 -%}
– {{ ‘general.meta.page’ | t: page: current_page }}
{%- endif -%}
{%- assign escaped_page_title = page_title | escape -%}
{%- unless escaped_page_title contains shop.name -%}
– {{ shop.name }}
{%- endunless -%}
{%- endcapture -%}

{{ seo_title | strip }}

{%- if page_description -%}

{%- endif -%}

{% include ‘social-meta-tags’ %}

{{ ‘theme.scss.css’ | asset_url | stylesheet_tag }}
{{ ‘eboost.css’ | asset_url | stylesheet_tag }}

{%- if request.page_type contains ‘customers/’ -%}

{%- endif -%}

{% include “starapps-pg-meta” %}

{% include ‘meteor-menu’, load: ‘head’ %}
{{ content_for_header }}

{% assign is_wcp_wholesale_customer = false %}
{% assign active_discounts = shop.metafields.wcp_active_discounts.wcp_active_discounts %}
{% assign active_discounts_array = active_discounts | split: ‘,’ %}
{% if shop.metafields.wcp_status.wcp_status != ‘disabled’ and customer %}
{% for discount_key in active_discounts_array %}
{% assign key_split = discount_key | split: ‘-’ %}
{% assign key_split_length = key_split | size %}
{% if key_split_length > 2 %}
{% assign removeable_key = key_split.last | prepend: ‘-’ %}
{% assign wcp_hide_sale_badge_customer_tag = discount_key | remove_first: removeable_key %}
{% else %}
{% assign wcp_hide_sale_badge_customer_tag = key_split[0] %}
{% endif %}
{% if customer.tags contains wcp_hide_sale_badge_customer_tag %}
{% assign is_wcp_wholesale_customer = true %}
{% endif %}
{% endfor %}
{% endif %}
{% unless is_wcp_wholesale_customer == true %}
{%- render ‘bold-options-hybrid’ -%}
{%- render ‘bold-common’ -%}
{% endunless %}

{% if template == ‘product’ and product.metafields.inventory.ShappifyHidden or product.type contains ‘HIDDEN’ %}{% endif %}

{% include ‘gem-app-header-scripts’ %}

{% include ‘pagefly-header’ %}
{% render ‘weglot_hreftags’ %}
{% render ‘weglot_switcher’ %}

{% include ‘bss-product-labels-configs’ %}
{% if template == ‘cart’ %}{% include “revy-bundle-script” %}{% endif %}

{{ ‘general.accessibility.skip_to_content’ | t }}

{%- if settings.enable_ajax -%}
{% include ‘cart-popup’ %}
{%- endif -%}

{% section ‘header’ %}

{% if template contains ‘wholesale’ %}
{% if customer %}
{% if customer.tags contains ‘wholesale’ %}
{{ content_for_layout }}
{% else %}
{% include ‘wholesale-note’ %}
{% endif %}
{% else %}
{% include ‘wholesale-note’ %}
{% endif %}
{% else%}
{{ content_for_layout }}
{% endif %}

{% include “arp” %}

{% section ‘footer’ %}

{{- 'sections.slideshow.navigation_instructions' | t -}}
  • {{ 'general.accessibility.refresh_page' | t }}
  • {{ 'general.accessibility.selection_help' | t }}
{% include 'magisto' %} {% comment %}This is for Badge Master By Hulkapps{% endcomment %} {% include 'hulkcode_trustbadge' %} {% render 'hextom_usb_main', product: product, customer: customer %}

{% include ‘smile-initializer’ %}

{% include ‘gem-app-footer-scripts’ %}

{% assign wcp_wholesale_customer = false %}
{% assign active_discounts = shop.metafields.wcp_active_discounts.wcp_active_discounts %}
{% assign active_discounts_array = active_discounts | split: ‘,’ %}
{% if shop.metafields.wcp_status.wcp_status != ‘disabled’ and customer %}
{% for discount_key in active_discounts_array %}
{% assign key_split = discount_key | split: ‘-’ %}
{% assign key_split_length = key_split | size %}
{% if key_split_length > 2 %}
{% assign removeable_key = key_split.last | prepend: ‘-’ %}
{% assign wcp_customer_tag = discount_key | remove_first: removeable_key %}
{% else %}
{% assign wcp_customer_tag = key_split[0] %}
{% endif %}
{% if customer.tags contains wcp_customer_tag %}
{% assign wcp_wholesale_customer = true %}
{% endif %}
{% endfor %}
{% endif %}
{% if wcp_wholesale_customer == false %}
{% comment %}{%render ‘sc-wholesale-simplified’%}{% endcomment %}
{% endif %}

{% if customer.tags.size > 0 and template != ‘cart’ %}

{% endif %}

{% if customer.tags.size > 0 and template == ‘cart’ %}
{% include ‘wcp_cart’ %}
{% endif %}

{% if template contains ‘product’ %}

.your_section_selector{background-color: gray;}

{% endif %}

.section-header { margin-bottom: 50px !important; marging-top: 15px !important; } } .grid--view-items { text-align: center; margin-top: 63px !important; } h3{ font-weight: bolder !important; font-size: 14px !important; } h4{ font-weight: bolder !important; font-size: 28px !important; } h2 { font-weight: bolder !important; font-size: 28px !important; th, td { text-align: left !important; border: solid 1px #d6d4d4 !important; padding: 10px 14px !important; }

{% render 'pagefly-head' %}
{% if request.path contains 'the-2021-agenda' %}

{% endif %}

{%- if settings.favicon != blank -%}

{%- endif -%}

{%- capture seo_title -%}
{%- if request.page_type == 'search' and search.performed == true -%}
{{ 'general.search.heading' | t: count: search.results_count }}: {{ 'general.search.results_with_count' | t: terms: search.terms, count: search.results_count }}
{%- else -%}
{{ page_title }}
{%- endif -%}
{%- if current_tags -%}
{%- assign meta_tags = current_tags | join: ', ' -%} – {{ 'general.meta.tags' | t: tags: meta_tags -}}
{%- endif -%}
{%- if current_page != 1 -%}
– {{ 'general.meta.page' | t: page: current_page }}
{%- endif -%}
{%- assign escaped_page_title = page_title | escape -%}
{%- unless escaped_page_title contains shop.name -%}
– {{ shop.name }}
{%- endunless -%}
{%- endcapture -%}

{%- if page_description -%}

{%- endif -%}

{% include 'social-meta-tags' %}

{{ 'theme.scss.css' | asset_url | stylesheet_tag }}
{{ 'eboost.css' | asset_url | stylesheet_tag }}

{%- if request.page_type contains 'customers/' -%}

{%- endif -%}

{% include "starapps-pg-meta" %}

{% include 'meteor-menu', load: 'head' %}
{{ content_for_header }}

{% assign is_wcp_wholesale_customer = false %}
{% assign active_discounts = shop.metafields.wcp_active_discounts.wcp_active_discounts %}
{% assign active_discounts_array = active_discounts | split: ',' %}
{% if shop.metafields.wcp_status.wcp_status != 'disabled' and customer %}
{% for discount_key in active_discounts_array %}
{% assign key_split = discount_key | split: '-' %}
{% assign key_split_length = key_split | size %}
{% if key_split_length > 2 %}
{% assign removeable_key = key_split.last | prepend: '-' %}
{% assign wcp_hide_sale_badge_customer_tag = discount_key | remove_first: removeable_key %}
{% else %}
{% assign wcp_hide_sale_badge_customer_tag = key_split[0] %}
{% endif %}
{% if customer.tags contains wcp_hide_sale_badge_customer_tag %}
{% assign is_wcp_wholesale_customer = true %}
{% endif %}
{% endfor %}
{% endif %}
{% unless is_wcp_wholesale_customer == true %}
{%- render 'bold-options-hybrid' -%}
{%- render 'bold-common' -%}
{% endunless %}

{% if template == 'product' and product.metafields.inventory.ShappifyHidden or product.type contains '_HIDDEN_' %}{% endif %}

{% include 'gem-app-header-scripts' %}

{% include 'pagefly-header' %}
{% render 'weglot_hreftags' %}
{% render 'weglot_switcher' %}

{% include 'bss-product-labels-configs' %}
{% if template == 'cart' %}{% include "revy-bundle-script" %}{% endif %}

{{ 'general.accessibility.skip_to_content' | t }}

{%- if settings.enable_ajax -%}
{% include 'cart-popup' %}
{%- endif -%}

{% section 'header' %}

{% section 'footer' %}

{{- 'sections.slideshow.navigation_instructions' | t -}}

- {{ 'general.accessibility.refresh_page' | t }}

- {{ 'general.accessibility.selection_help' | t }}

{% include 'magisto' %}

{% comment %}This is for Badge Master By Hulkapps{% endcomment %} {% include 'hulkcode_trustbadge' %}

{% render 'hextom_usb_main', product: product, customer: customer %}

{% include 'smile-initializer' %}

{% include 'gem-app-footer-scripts' %}

{% assign wcp_wholesale_customer = false %}
{% assign active_discounts = shop.metafields.wcp_active_discounts.wcp_active_discounts %}
{% assign active_discounts_array = active_discounts | split: ',' %}
{% if shop.metafields.wcp_status.wcp_status != 'disabled' and customer %}
{% for discount_key in active_discounts_array %}
{% assign key_split = discount_key | split: '-' %}
{% assign key_split_length = key_split | size %}
{% if key_split_length > 2 %}
{% assign removeable_key = key_split.last | prepend: '-' %}
{% assign wcp_customer_tag = discount_key | remove_first: removeable_key %}
{% else %}
{% assign wcp_customer_tag = key_split[0] %}
{% endif %}
{% if customer.tags contains wcp_customer_tag %}
{% assign wcp_wholesale_customer = true %}
{% endif %}
{% endfor %}
{% endif %}
{% if wcp_wholesale_customer == false %}
{% comment %}{%render 'sc-wholesale-simplified'%}{% endcomment %}
{% endif %}

{% if customer.tags.size > 0 and template != 'cart' %}

{% endif %}

{% if customer.tags.size > 0 and template == 'cart' %}
{% include 'wcp_cart' %}
{% endif %}

{% if template contains 'product' %}

{% endif %}

{% endif %}

{%- if settings.favicon != blank -%}

{%- endif -%}

{%- capture seo_title -%}
{%- if request.page_type == 'search' and search.performed == true -%}
{{ 'general.search.heading' | t: count: search.results_count }}: {{ 'general.search.results_with_count' | t: terms: search.terms, count: search.results_count }}
{%- else -%}
{{ page_title }}
{%- endif -%}
{%- if current_tags -%}
{%- assign meta_tags = current_tags | join: ', ' -%} – {{ 'general.meta.tags' | t: tags: meta_tags -}}
{%- endif -%}
{%- if current_page != 1 -%}
– {{ 'general.meta.page' | t: page: current_page }}
{%- endif -%}
{%- assign escaped_page_title = page_title | escape -%}
{%- unless escaped_page_title contains shop.name -%}
– {{ shop.name }}
{%- endunless -%}
{%- endcapture -%}

{%- if page_description -%}

{%- endif -%}

{% include 'social-meta-tags' %}

{{ 'theme.scss.css' | asset_url | stylesheet_tag }}
{{ 'eboost.css' | asset_url | stylesheet_tag }}

{%- if request.page_type contains 'customers/' -%}

{%- endif -%}

{% include "starapps-pg-meta" %}

{% include 'meteor-menu', load: 'head' %}
{{ content_for_header }}

{% assign is_wcp_wholesale_customer = false %}
{% assign active_discounts = shop.metafields.wcp_active_discounts.wcp_active_discounts %}
{% assign active_discounts_array = active_discounts | split: ',' %}
{% if shop.metafields.wcp_status.wcp_status != 'disabled' and customer %}
{% for discount_key in active_discounts_array %}
{% assign key_split = discount_key | split: '-' %}
{% assign key_split_length = key_split | size %}
{% if key_split_length > 2 %}
{% assign removeable_key = key_split.last | prepend: '-' %}
{% assign wcp_hide_sale_badge_customer_tag = discount_key | remove_first: removeable_key %}
{% else %}
{% assign wcp_hide_sale_badge_customer_tag = key_split[0] %}
{% endif %}
{% if customer.tags contains wcp_hide_sale_badge_customer_tag %}
{% assign is_wcp_wholesale_customer = true %}
{% endif %}
{% endfor %}
{% endif %}
{% unless is_wcp_wholesale_customer == true %}
{%- render 'bold-options-hybrid' -%}
{%- render 'bold-common' -%}
{% endunless %}

{% if template == 'product' and product.metafields.inventory.ShappifyHidden or product.type contains '_HIDDEN_' %}{% endif %}

{% include 'gem-app-header-scripts' %}

{% include 'pagefly-header' %}
{% render 'weglot_hreftags' %}
{% render 'weglot_switcher' %}

{% include 'bss-product-labels-configs' %}
{% if template == 'cart' %}{% include "revy-bundle-script" %}{% endif %}

{{ 'general.accessibility.skip_to_content' | t }}

{%- if settings.enable_ajax -%}
{% include 'cart-popup' %}
{%- endif -%}

{% section 'header' %}

{% section 'footer' %}

{{- 'sections.slideshow.navigation_instructions' | t -}}

- {{ 'general.accessibility.refresh_page' | t }}

- {{ 'general.accessibility.selection_help' | t }}

{% include 'magisto' %}

{% comment %}This is for Badge Master By Hulkapps{% endcomment %} {% include 'hulkcode_trustbadge' %}

{% render 'hextom_usb_main', product: product, customer: customer %}

{% include 'smile-initializer' %}

{% include 'gem-app-footer-scripts' %}

{% assign wcp_wholesale_customer = false %}
{% assign active_discounts = shop.metafields.wcp_active_discounts.wcp_active_discounts %}
{% assign active_discounts_array = active_discounts | split: ',' %}
{% if shop.metafields.wcp_status.wcp_status != 'disabled' and customer %}
{% for discount_key in active_discounts_array %}
{% assign key_split = discount_key | split: '-' %}
{% assign key_split_length = key_split | size %}
{% if key_split_length > 2 %}
{% assign removeable_key = key_split.last | prepend: '-' %}
{% assign wcp_customer_tag = discount_key | remove_first: removeable_key %}
{% else %}
{% assign wcp_customer_tag = key_split[0] %}
{% endif %}
{% if customer.tags contains wcp_customer_tag %}
{% assign wcp_wholesale_customer = true %}
{% endif %}
{% endfor %}
{% endif %}
{% if wcp_wholesale_customer == false %}
{% comment %}{%render 'sc-wholesale-simplified'%}{% endcomment %}
{% endif %}

{% if customer.tags.size > 0 and template != 'cart' %}

{% endif %}

{% if customer.tags.size > 0 and template == 'cart' %}
{% include 'wcp_cart' %}
{% endif %}

{% if template contains 'product' %}

{% endif %}

you can add new code for theme.liquid

Hi Victor,

When you click “Add to cart” botton from PageFly ection, it adds to the cart but also goes to the cart page. It is not supposed to go to the cart page.

Hi @Alliance ,

I checked and fix your issue, you can re-check and give me feedback

Yes. You fixed it from PageFly end. Thank you

1 Like

Great! I’m glad to hear that it works well on your end :blush:

1 Like