Jump to content

Commerce - moving additional info on all but one page

Recommended Posts

Site URL: https://www.chococake.co.uk/

Hey,

I've used jQuery to move the Additional Info of my products up to the product description area using the code below (from this post):
 

<script>
  jQuery(document).ready(function($) {
$('.ProductItem .ProductItem-additional').insertAfter('.ProductItem-details-excerpt');
});
</script>

I'm wondering if anyone knows how to disable this on a single product. I've looked into not selectors but unfortunately my coding brain has peaked!

The specific product page I would like it in it's original location is:
https://chococake.squarespace.com/shop-for-collection/p/box-of-chococo-chocolates

Thanks for your help!

Link to comment
  • Replies 3
  • Views 533
  • Created
  • Last Reply
7 minutes ago, kirstym said:

Site URL: https://www.chococake.co.uk/

Hey,

I've used jQuery to move the Additional Info of my products up to the product description area using the code below (from this post😞
 

<script>
  jQuery(document).ready(function($) {
$('.ProductItem .ProductItem-additional').insertAfter('.ProductItem-details-excerpt');
});
</script>

I'm wondering if anyone knows how to disable this on a single product. I've looked into not selectors but unfortunately my coding brain has peaked!

The specific product page I would like it in it's original location is:
https://chococake.squarespace.com/shop-for-collection/p/box-of-chococo-chocolates

Thanks for your help!

 

9 minutes ago, kirstym said:

Site URL: https://www.chococake.co.uk/

Hey,

I've used jQuery to move the Additional Info of my products up to the product description area using the code below (from this post😞
 

<script>
  jQuery(document).ready(function($) {
$('.ProductItem .ProductItem-additional').insertAfter('.ProductItem-details-excerpt');
});
</script>

I'm wondering if anyone knows how to disable this on a single product. I've looked into not selectors but unfortunately my coding brain has peaked!

The specific product page I would like it in it's original location is:
https://chococake.squarespace.com/shop-for-collection/p/box-of-chococo-chocolates

Thanks for your help!

Each product has it own id, in your case, update the snippet to make it stay where it were

Squarespace ID Finder - Chrome Web Store (google.com)

<script>
 jQuery(document).ready(function($) {
    if (!$("body").is("#item-6065a9ba00c5a575a39fbe31")) {
        	$('.ProductItem .ProductItem-additional').insertAfter('.ProductItem-details-excerpt');
    }
});
</script>

image.png.5b74018ec28867139123767f7e7d1e38.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Hey, thank you so much for the updated code and the explanation. That works perfectly!
If you don't mind, are you able to explain why it works?

I understand targeting the specific product using the item id, but how does the code work? But by my logic, it reads that the code would apply moving the additional details ONLY on that page, rather than not on that page. Does that make sense?

You don't have to reply, it works fine and thank you so much! I'm just curious.

Link to comment
11 hours ago, kirstym said:

Hey, thank you so much for the updated code and the explanation. That works perfectly!
If you don't mind, are you able to explain why it works?

I understand targeting the specific product using the item id, but how does the code work? But by my logic, it reads that the code would apply moving the additional details ONLY on that page, rather than not on that page. Does that make sense?

You don't have to reply, it works fine and thank you so much! I'm just curious.

This line target all the page that DID NOT have the specific id, and move the text accordingly, it a javascript syntax

if (!$("body").is("#item-6065a9ba00c5a575a39fbe31")) {

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.