Product Template - Custom Template Is Throwing off styling

Solved
kaykills
New Member
2 0 1

Hi. I am working on a Shopify site for a client. I am not an expert, however my issue is that I am more wondering why something is happening. 

 

The product.liquid file is mostly empty with a couple of includes.

<!-- AAA: Memberships (product) -->

<!-- end AAA code -->
<!-- spurit_sri-added -->

<!-- /spurit_sri-added -->

{%- comment %}<locksmith:fc9d>{% endcomment -%}
  {%- assign _ff41_safe_variants = '' %}{% for _variant in product.variants %}{% include 'locksmith-variables', locksmith_scope: 'subject', locksmith_subject: _variant, locksmith_subject_parent: product %}{% if locksmith_transparent %}{% else %}{% continue %}{% endif %}{% capture _ff41_safe_variants %}{% if _ff41_safe_variants != blank %}{{ _ff41_safe_variants }},{% endif %}{{ _variant | json }}{% endcapture %}{% endfor %}{% capture _ff41_safe_variants %}[{{ _ff41_safe_variants }}]{% endcapture %}{% assign _ff41_unsafe_variants = product.variants | json %}{% assign _ff41_safe_options = product.options | json %}{% assign _ff41_unsafe_options = product.options | json %}{% for _option in product.options %}{% assign _safe_values = '' %}{% for _value in _option.values %}{% include 'locksmith-variables', locksmith_scope: 'subject', locksmith_subject: _value, locksmith_subject_parent: _option %}{% if locksmith_transparent %}{% else %}{% continue %}{% endif %}{% capture _safe_values %}{% if _safe_values != blank %}{{ _safe_values }},{% endif %}{{ _value | json }}{% endcapture %}{% endfor %}{% capture _safe_values %}[{{ _safe_values }}]{% endcapture %}{% assign _unsafe_values = _option.values | json %}{% assign _unsafe_option = _option | json %}{% assign _safe_option = _unsafe_option | replace: _unsafe_values, _safe_values %}{% assign _ff41_safe_options = _ff41_safe_options | replace: _unsafe_option, _safe_option %}{% endfor %}{% assign _ff41_unsafe_options = product.options | json -%}
{%- comment %}</locksmith:fc9d>{% endcomment -%}

{% section 'product-template' %}
{% include 'facebook-tags' %}
<script>theme.productData[{{ product.id }}] = {%- comment %}<locksmith:a854>{% endcomment -%}{{- product | json | replace: _ff41_unsafe_variants, _ff41_safe_variants | replace: _ff41_unsafe_options, _ff41_safe_options -}}{%- comment %}</locksmith:a854>{% endcomment -%};</script>

 

So to me this looks okay. Most of the code is contained in the product-template.liquid file in sections.  I am creating a new product template, so I have assumed that all I am going to do is create a template called product.coffee.liquid and I'll duplicate the code above and add a product-template-coffee.liquid file in sections.  This is pretty straightforward for me.

My new template now looks like this.

 

<!-- AAA: Memberships (product) -->

<!-- end AAA code -->
<!-- spurit_sri-added -->

<!-- /spurit_sri-added -->

{%- comment %}<locksmith:fc9d>{% endcomment -%}
  {%- assign _ff41_safe_variants = '' %}{% for _variant in product.variants %}{% include 'locksmith-variables', locksmith_scope: 'subject', locksmith_subject: _variant, locksmith_subject_parent: product %}{% if locksmith_transparent %}{% else %}{% continue %}{% endif %}{% capture _ff41_safe_variants %}{% if _ff41_safe_variants != blank %}{{ _ff41_safe_variants }},{% endif %}{{ _variant | json }}{% endcapture %}{% endfor %}{% capture _ff41_safe_variants %}[{{ _ff41_safe_variants }}]{% endcapture %}{% assign _ff41_unsafe_variants = product.variants | json %}{% assign _ff41_safe_options = product.options | json %}{% assign _ff41_unsafe_options = product.options | json %}{% for _option in product.options %}{% assign _safe_values = '' %}{% for _value in _option.values %}{% include 'locksmith-variables', locksmith_scope: 'subject', locksmith_subject: _value, locksmith_subject_parent: _option %}{% if locksmith_transparent %}{% else %}{% continue %}{% endif %}{% capture _safe_values %}{% if _safe_values != blank %}{{ _safe_values }},{% endif %}{{ _value | json }}{% endcapture %}{% endfor %}{% capture _safe_values %}[{{ _safe_values }}]{% endcapture %}{% assign _unsafe_values = _option.values | json %}{% assign _unsafe_option = _option | json %}{% assign _safe_option = _unsafe_option | replace: _unsafe_values, _safe_values %}{% assign _ff41_safe_options = _ff41_safe_options | replace: _unsafe_option, _safe_option %}{% endfor %}{% assign _ff41_unsafe_options = product.options | json -%}
{%- comment %}</locksmith:fc9d>{% endcomment -%}

{% section 'product-template-coffee' %}
{% include 'facebook-tags' %}
<script>theme.productData[{{ product.id }}] = {%- comment %}<locksmith:a854>{% endcomment -%}{{- product | json | replace: _ff41_unsafe_variants, _ff41_safe_variants | replace: _ff41_unsafe_options, _ff41_safe_options -}}{%- comment %}</locksmith:a854>{% endcomment -%};</script>

 

The only difference in the two files in the section include. I have duplicated both section includes so they are idential. My problem is, the coffee template is throwing off the styling on the page even though the two product template includes are exactly the same. 

 

Can anyone let me know if there is something I am missing here?  Are there other default flies being discluded because I have created a new template? 

 

Thanks in advance for any insight.  This is the last thing I need to figure out to complete my project and I am totally stumped. 

 

 

 

0 Likes
iDoThemes
Trailblazer
136 29 51

This is an accepted solution.

Could be you have a CSS rule that targets a section called product-template like .section--product-template{...} and other things inside it, which isn't working on the product-template-coffee template. Hard to say without seeing the issue.

Developer of Liquify Chrome Extension -- Enhance the Shopify Theme Code Editor

Theme Developer -- Drop me a line
0 Likes
kaykills
New Member
2 0 1

Thank you for the reply. This helped me start thinking about other potential problems. There were a couple styles that were targeting the product.template class, however I also needed to the settings_data.json file which has a bunch of layout and option settings that was being ignored, once I changed the template.

Thank you again for the reply. All good now.