Add css to product tabs on Narrative theme

Hi there,

I would like my product tabs to look like they do on this page: https://www.ooninz.co.nz/collections/ooni-pizza-ovens/products/ooni-pro-multi-fuel-pizza-oven

(But inverted, so black background and white text/lines)

It’s currently looking like this (done on a non published theme :disappointed_face:

https://bigsofti.myshopify.com/

Is this possible? Would love some guidance!

Thanks so much :slightly_smiling_face:

1 Like

@INFRA

sorry for that

can you please try this

https://happypoints.io/add-tabs-to-shopify-product-page-without-app-c2-stt-57/

1 Like

HI @KetanKumar Thanks for your help but these tabs are not exactly what I need. I am currently using

tags in my description to create custom tabs for each product :slightly_smiling_face:

1 Like

@INFRA

ok but sorry i can’t see any tab on product please share product url

@KetanKumar this is done on a non live theme :slightly_smiling_face:

I have used this code in the product template instead of the description:

{% capture more-tabs %}
{{product.description }}

REVIEWS
{{ product.metafields.spr.reviews }}
{% endcapture %} {% include 'tabbed-description' with more-tabs %}

And this is the Tabbed description Snippet:

{% comment %}
  if combine_pretext is false, the text before the first ######  will be shown above all tabs, otherwise added to the first tab
  if stop_on_h5 is true, tabs parsing will stop on first H5 element and the rest will be shown below tabs.
  What's inside H5 is discarded, but still put something meneningfull there, just in case you switch theme or alike.
  No multiple H5 elements.
{% endcomment %}
{% assign combine_pretext = false %}
{% assign stop_on_h5  = true %}

{% assign description = tabbed-description | default: product.description %}
{% if description contains "###### " %}
      {% assign tab_heads = '' %}
      {% assign tab_texts = '' %}
      {% assign pretext  = ''  %}
      {% assign posttext = ''  %}
      
      {% if stop_on_h5 and description contains "##### " %}
        {% assign posttext = description | split: "" | last %}
        {% assign description = description | split: "##### " | first %}
      {% endif %}

      {% assign chunks = description | strip | split: "###### " %}
      {% for c in chunks %}
          {% if c contains "" %}
              {% assign chunk = c | split: "" %}
              {% assign tab_heads = tab_heads | append: ",," | append: chunk.first %}
              {% assign tab_texts = tab_texts | append: ",," %}
              {% if pretext != blank  and combine_pretext %}
                  {% assign tab_texts = tab_texts | append: pretext | append: "
" %}
                  {% assign pretext = '' %}
              {% endif %}
              {% assign tab_texts = tab_texts | append: chunk.last  %}
          {% elsif forloop.first %}
              {% assign pretext =  c %}
          {% endif %}
      {% endfor %}

      {% assign tab_heads = tab_heads | remove_first: ",," | split: ",," %}
      {% assign tab_texts = tab_texts | remove_first: ",," | split: ",," %}

      {% assign index =  1  %}
      {% if pretext != blank and combine_pretext == false %}
        
{{ pretext }}

      {% endif %}

      
        

          {% for head in tab_heads %}
              - {{ head }}
              {% assign index =  index | plus: 1  %}
          {% endfor %}
        

        {% assign index =  1  %}
        {% for text in tab_texts %}
          {{ text }}

          {% assign index =  index | plus: 1  %}
        {% endfor %}
      

      {% if posttext != blank %}
          {{ posttext }}

      {% endif %}

  

  

{% else %}
    {{ description }}
{% endif %}

hope that makes sense :slightly_smiling_face:

1 Like

@INFRA i know that but can you please share particular product url if you have added tab?

1 Like

it’s on this product:

https://bigsofti.com/products/bigsofti-lighting-module

(on the non live theme)

1 Like

@INFRA

sorry i can’t see this product tab can you please share particular theme if you have add tab code?

@INFRA

Please replace following code Snippets/tabbed-description.liquid file.

{% comment %}
  if combine_pretext is false, the text before the first ######  will be shown above all tabs, otherwise added to the first tab
  if stop_on_h5 is true, tabs parsing will stop on first H5 element and the rest will be shown below tabs.
  What's inside H5 is discarded, but still put something meneningfull there, just in case you switch theme or alike.
  No multiple H5 elements.
{% endcomment %}
{% assign combine_pretext = false %}
{% assign stop_on_h5  = true %}

{% assign description = tabbed-description | default: product.description %}
{% if description contains "###### " %}
      {% assign tab_heads = '' %}
      {% assign tab_texts = '' %}
      {% assign pretext  = ''  %}
      {% assign posttext = ''  %}
      
      {% if stop_on_h5 and description contains "##### " %}
        {% assign posttext = description | split: "" | last %}
        {% assign description = description | split: "##### " | first %}
      {% endif %}

      {% assign chunks = description | strip | split: "###### " %}
      {% for c in chunks %}
          {% if c contains "" %}
              {% assign chunk = c | split: "" %}
              {% assign tab_heads = tab_heads | append: ",," | append: chunk.first %}
              {% assign tab_texts = tab_texts | append: ",," %}
              {% if pretext != blank  and combine_pretext %}
                  {% assign tab_texts = tab_texts | append: pretext | append: "
" %}
                  {% assign pretext = '' %}
              {% endif %}
              {% assign tab_texts = tab_texts | append: chunk.last  %}
          {% elsif forloop.first %}
              {% assign pretext =  c %}
          {% endif %}
      {% endfor %}

      {% assign tab_heads = tab_heads | remove_first: ",," | split: ",," %}
      {% assign tab_texts = tab_texts | remove_first: ",," | split: ",," %}

      {% assign index =  1  %}
      {% if pretext != blank and combine_pretext == false %}
        
{{ pretext }}

      {% endif %}

      
        

          {% for head in tab_heads %}
              - {{ head }}
              {% assign index =  index | plus: 1  %}
          {% endfor %}
        

        {% assign index =  1  %}
        {% for text in tab_texts %}
          {{ text }}

          {% assign index =  index | plus: 1  %}
        {% endfor %}
      

      {% if posttext != blank %}
          {{ posttext }}

      {% endif %}

  

  

{% else %}
    {{ description }}
{% endif %}
  1. Go to Online Store->Theme->Edit code

  2. Asset->/theme.scss.liquid->paste below code at the bottom of the file.

.template-product .page-width {
    zoom: 1;
    max-width: 100%;
    padding: 0 20px;
    margin: 0 auto;
}

Thanks!

1 Like

hi @dmwwebartisan thank you so much, that worked perfectly!

I have just decreased the margin width of the text a bit, as well as the product page width itself :slightly_smiling_face:

THANKS!

@dmwwebartisan actually would it be possible to get rid of the white line next to reviews? See below :slightly_smiling_face:

And how do I get those stars below the title to appear in the centre? They are coming up on the left :slightly_smiling_face:

Thanks so much!

@INFRA

Please replace following code Snippets/tabbed-description.liquid file.

{% comment %}
  if combine_pretext is false, the text before the first ######  will be shown above all tabs, otherwise added to the first tab
  if stop_on_h5 is true, tabs parsing will stop on first H5 element and the rest will be shown below tabs.
  What's inside H5 is discarded, but still put something meneningfull there, just in case you switch theme or alike.
  No multiple H5 elements.
{% endcomment %}
{% assign combine_pretext = false %}
{% assign stop_on_h5  = true %}

{% assign description = tabbed-description | default: product.description %}
{% if description contains "###### " %}
      {% assign tab_heads = '' %}
      {% assign tab_texts = '' %}
      {% assign pretext  = ''  %}
      {% assign posttext = ''  %}
      
      {% if stop_on_h5 and description contains "##### " %}
        {% assign posttext = description | split: "" | last %}
        {% assign description = description | split: "##### " | first %}
      {% endif %}

      {% assign chunks = description | strip | split: "###### " %}
      {% for c in chunks %}
          {% if c contains "" %}
              {% assign chunk = c | split: "" %}
              {% assign tab_heads = tab_heads | append: ",," | append: chunk.first %}
              {% assign tab_texts = tab_texts | append: ",," %}
              {% if pretext != blank  and combine_pretext %}
                  {% assign tab_texts = tab_texts | append: pretext | append: "
" %}
                  {% assign pretext = '' %}
              {% endif %}
              {% assign tab_texts = tab_texts | append: chunk.last  %}
          {% elsif forloop.first %}
              {% assign pretext =  c %}
          {% endif %}
      {% endfor %}

      {% assign tab_heads = tab_heads | remove_first: ",," | split: ",," %}
      {% assign tab_texts = tab_texts | remove_first: ",," | split: ",," %}

      {% assign index =  1  %}
      {% if pretext != blank and combine_pretext == false %}
        
{{ pretext }}

      {% endif %}

      
        

          {% for head in tab_heads %}
              - {{ head }}
              {% assign index =  index | plus: 1  %}
          {% endfor %}
        

        {% assign index =  1  %}
        {% for text in tab_texts %}
          {{ text }}

          {% assign index =  index | plus: 1  %}
        {% endfor %}
      

      {% if posttext != blank %}
          {{ posttext }}

      {% endif %}

  

  

{% else %}
    {{ description }}
{% endif %}
  1. Go to Online Store->Theme->Edit code

  2. Asset->/theme.scss.liquid->paste below code at the bottom of the file.

.template-product .text-center {text-align: left !important;}
.template-product .afterpay-paragraph{text-align: left !important;}

Thanks!

1 Like

hi @dmwwebartisan thanks so much! The line is now gone however, the stars are still on the left side. Any idea how to fix this?

thank you!

@INFRA

Please share screenshot what do you want .

Thanks!

it currently looks like this, stars on the left

but should look like this, with the stars centred

Thank you!

1 Like

@dmwwebartisan Sorry forgot to tag you in my last reply! Would you be able to have a look at my previous post? Thanks so much!

1 Like

@INFRA

I will look into it and get back to you soon.

1 Like

@dmwwebartisan hi! any luck on this? thank u!

1 Like

@INFRA

Please add this at the bottom of your assets/theme.scss.liquid file.

.spr-badge {
    text-align: center !important;
}

Hope this works.

Thanks!

1 Like

@dmwwebartisan thanks so much, worked perfectly!

1 Like