Jump to content

[Share] Add a Section to Product Detail

Recommended Posts

Some code to add a Section to Product Detail Page (in Additional Info)

  • Add to some products
  • Add to all products

I will share 2 ways to do these

  • Use Section in Site Footer
  • Use a page in Not Linked (require plugin) 

If you can't install the code, you can comment below or message me, I will help you install it.

Here I have not written code for another case: When you want to use Different Section for Different products. If you have this problem, just comment below with your detail request + site url, I will provide the code

A. Use Section in Site Footer

#1. Add to all products

First you need to add a Section to Site Footer. Let's say it's the second section in Footer

Next, add this code to Website Tools (under Not Linked) > Custom CSS. The code will hide this section on all pages (exclude Product Detail Page)

footer.sections section:nth-child(2) {
	display: none !important;
}

Next, add this code to Website Tools (under Not Linked) > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $('footer.sections section:nth-child(2)').insertAfter('section.ProductItem-additional');
});
</script>
<style>
  section.ProductItem-additional+section {
    display: block !important;
}
</style>

#2. Add to some specific products

First, you create a tag with name: more-info

and assign it for all products where you want to add section

image.png.a61c5f8baa28e0fe4d052641ab2b0fca.png

Next, add this code to Website Tools (under Not Linked) > Custom CSS. The code will hide this section on all pages (exclude Product Detail Page)

footer.sections section:nth-child(2) {
	display: none !important;
}

Next, add this code to Website Tools (under Not Linked) > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $('footer.sections section:nth-child(2)').insertAfter('.tag-more-info section.ProductItem-additional');
});
</script>
<style>
  .tag-more-info section.ProductItem-additional+section {
    display: block !important;
}
</style>

A. Use a Not Linked Page

#1. Add to all products

First, you need to install Section Loader Supreme Plugin

https://www.will-myers.com/products/p/section-loader-supreme

Next, add a Page in Not Linked Page

  • Name: Product Additional Info
  • URL: /product-additional-info

then design your layout

image.thumb.png.1b6e2a886486b0cee72f3d1efdb7866f.png

Next, add this code to Shop/Store Page Header Code Injection

<div data-wm-plugin="load" data-target="/product-additional-info"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
jQuery(document).ready(function($){
  $('[data-wm-plugin]').insertAfter('section.ProductItem-additional');
})
</script>
<style>
  section.ProductItem-additional+[data-wm-plugin] {
    display: block !important;
}
</style>

image.thumb.png.a5ed6605fd2496c96c756227cc8a5c99.png

Next, add this code to Website Tools (under Not Linked) > Custom CSS

Use this code, because the content in Not Linked Page will appears on top of product 1-2 seconds before disappear

[data-wm-plugin] {
    display: none;
}

#2. Add to some specific products

Similar (A), add tag: more-info

then use this code to Shop Page Header Code Injection

<div data-wm-plugin="load" data-target="/product-additional-info"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
jQuery(document).ready(function($){
  $('[data-wm-plugin]').insertAfter('.tag-more-info section.ProductItem-additional');
})
</script>
<style>
  .tag-more-info section.ProductItem-additional+[data-wm-plugin] {
    display: block !important;
}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Replies 0
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.