kirstym Posted April 1, 2021 Posted April 1, 2021 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!
Beyondspace Posted April 1, 2021 Posted April 1, 2021 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> BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
kirstym Posted April 1, 2021 Author Posted April 1, 2021 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.
Beyondspace Posted April 2, 2021 Posted April 2, 2021 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 (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
Recommended Posts
Archived
This topic is now archived and is closed to further replies.