help how to add {% comment %}{{content_for_header}}{% endcomment %} instead of{{ content_for_header

Topic summary

A Shopify store owner is attempting to improve site speed by commenting out the {{ content_for_header }} Liquid tag in their theme.liquid file using {% comment %}{{ content_for_header }}{% endcomment %}.

The Problem:

  • While this change successfully increased page speed, it broke several store functions
  • Specifically affected: color swatches and recently viewed products section
  • The store (divarouj.com) now has non-functional features after the modification

Technical Context:

  • The {{ content_for_header }} tag is essential for Shopify’s core functionality
  • Commenting it out removes critical scripts and tracking codes that many features depend on
  • The user shared their theme.liquid code (which appears corrupted/reversed in the original post)

Current Status:
The discussion remains unresolved. One community member requested clearer information about what specific changes are desired and how things should work differently, but communication barriers persist. The fundamental issue is that commenting out content_for_header creates a trade-off between speed and functionality that cannot be easily resolved without alternative optimization approaches.

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

I’m not sure if I understand what you’re asking for here.

Anything you put between {% comment %} and {% endcomment %} tags is turned into a comment.

If you’re asking me to comment out the " {{ content_for_header }}" part, then this is how it would look:


{%- liquid
  assign t_name     = request.page_type
  assign iso_code   = request.locale.iso_code
  assign use_rtl    = settings.use_rtl
  if use_rtl == '3'
    assign lis_rtl  = 'ar; dv; ha; he; ku; fa; ur; ug; ps; yi'
    assign iso_code_ck = iso_code | split: '-' | first
  else 
    assign lis_rtl = settings.list_rtl
    assign iso_code_ck = iso_code
  endif
  if use_rtl == '1'
    assign isRTL = true
  elsif lis_rtl contains iso_code_ck and use_rtl == '2' or use_rtl == '3'
    assign isRTL = true
  else
    assign isRTL = false
  endif
  assign body_img = settings.body_bg_image
  if body_img != blank and settings.general_layout == 'boxed'
    assign class_lazy = 'lazyloadt4s'
  endif -%}
{%- capture class_html -%}
t4sp-theme t4s-wrapper__{{ settings.general_layout }} rtl_{{ isRTL }} swatch_color_style_{{ settings.swatch_color_style }} pr_border_style_{{ settings.pr_border_style }} pr_img_effect_{{ settings.pr_img_effect }} enable_eff_img1_{{ settings.enable_eff_img1 }} badge_shape_{{ settings.badge_shape }} css_for_wis_app_{{ settings.enable_css_wis }}{% if settings.use_cus_lz and settings.cus_lz %} t4s-lzcus-true{% endif %} shadow_round_img_{{ settings.enable_shadow_round_img }} t4s-header__{{ settings.header_design }} is-remove-unavai-{{ settings.variant_remove }} t4_compare_{{ settings.enable_compe }}{% if settings.type_qv == '1' %} t4s-sidebar-qv{% endif %} t4s-cart-count-{{ cart.item_count }} t4s-pr-ellipsis-{{ settings.enable_pr_ellipsis }}
{%- endcapture -%}

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

    {%- if settings.font_source == '1' and settings.fnt_fm_sp1.system? == false or settings.fnt_fm_sp2.system? == false or settings.fnt_fm_sp3.system? == false -%}
      
    {%- endif -%}
    
    {%- if t_name != 'list-collections' -%}
    {%- capture seo_title -%}
      {%- if template == 'search' and search.performed == true -%}{{ 'search.general.heading' | t: count: search.results_count }}: {{ 'search.results_with_count_and_term' | t: terms: search.terms, count: search.results_count }}{%- elsif template == 'search.wishlist' %}{{ 'wishlist_page.meta' | t }}{%- elsif template == 'search.compare' %}{{ 'compare_page.meta' | t }}{%- 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 -%}
    
    
    {%- else -%}
    
    {%- endif -%}

    {%- render 'meta-tags', t_name: t_name -%}
    
    
    
  
{% comment %}
    {{ content_for_header }}
{% endcomment %}
    
    {%- render 'head_assets', t_name: t_name, isRTL: isRTL -%}
    
  

  {% if isRTL %}{% endif -%}
    {{ "accessibility.skip_to_text" | t }}
    

    
      {%- render 'header', t_name: t_name -%}

      

      
    

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

    {%- render 'render_bottom' -%}