Last active
May 18, 2021 08:39
-
-
Save projoomexperts/8888ad587081d9d9b3b1f380739e1b69 to your computer and use it in GitHub Desktop.
Very simple code to show tabs in your shopify product description. All you need is to replace {{ product.description }} with the code below. It will separate every <h3> tag and contents after it into a tab. feel free to contact me if you want it implemented on your website for a small one time fee. `[email protected]` "Shopify product des…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign description = product.description | replace: '<h3', '</div><div class="tab-content"><h3' %} | |
<div class="prod_description"> | |
<div class="spacer"> | |
{{ description }} | |
</div> | |
</div> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> | |
<script> | |
jQuery(document).ready(function(){ | |
var tabTitle = '<ul>'; | |
jQuery('.prod_description > div.tab-content').each(function(i, item){ | |
jQuery(this).attr('id', "tabs-" + i); | |
var titletext = jQuery(this).find('h3').text(); | |
var titlelist = '<li><a href="#tabs-' + i + '">' + titletext + '</a></li>' | |
tabTitle += titlelist ; | |
}); | |
tabTitle += '</ul>'; | |
jQuery( tabTitle ).insertAfter('.spacer'); | |
jQuery('.spacer').remove(); | |
jQuery( ".prod_description" ).tabs(); | |
}) | |
</script> |
Hi, Donot edit the product.liquid file for debut theme. For debut theme its inside /sections/product-template.liquid file.
Hello, thanks but after replacing the {{ product.description }} code within the /sections/product-template.liquid file. as suggested, this still hasn't worked for me. My site is https://marblewallpaper.co.uk/products/black-and-pink-waterproof-marble-vinyl-self-adhesive-wallpaper
@wesdoesdev
Your website has some javascript conflicts. To get the script working you need to solve them.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Donot edit the product.liquid file for debut theme. For debut theme its inside /sections/product-template.liquid file.