redlaura99 Posted August 11, 2020 Share Posted August 11, 2020 (edited) Site URL: https://www.middleburgtack.com/jumping Greetings! I would like to display the SKU on the product pages, does anyone have any suggestions for that? I'm sure there's a way to do it with some code insertion but I'm not smart enough to do it. I'd like the SKU to show on the main product pages below the price. Thanks! Edited August 11, 2020 by redlaura99 Link to comment
paul2009 Posted August 11, 2020 Share Posted August 11, 2020 On Product List pages like https://www.middleburgtack.com/jumping, the SKU is not in the markup and so it isn't straightforward to display it. The SKU can be extracted from the JSON but as you are using filtering, this will delay page loading. As you appear to be using the SKU for image filenames, an easier option will be to display the image name below the price. About: Squarespace Circle Leader since 2017. I value honesty, transparency, diversity and great design ♥.Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™. Content: Links in my posts may refer to SF Digital products or may be affiliate links. Catch up on all the release notes and announcements 2023 [for Circle members only]. There's a public version here too!If I helped, you can thank me by clicking one of the emojis below. If you prefer, you can buy me a coffee.Improve your online store with our extensions. Link to comment
redlaura99 Posted August 12, 2020 Author Share Posted August 12, 2020 3 hours ago, paul2009 said: On Product List pages like https://www.middleburgtack.com/jumping, the SKU is not in the markup and so it isn't straightforward to display it. The SKU can be extracted from the JSON but as you are using filtering, this will delay page loading. As you appear to be using the SKU for image filenames, an easier option will be to display the image name below the price. That would be a great solution, thanks so much for the insight. Forgive me if I missed it in the styles and settings, would this need to be done through code injection or is that an option I'm missing somewhere? Link to comment
Sophik Posted October 9, 2021 Share Posted October 9, 2021 this is what i did to insert the SKU right below the price on a single product page (don't have this for category/list page)... hope it helps. <script> jQuery(document).ready(function() { jQuery("<div id='sku'></div>").insertAfter(".ProductItem-product-price" ); var pathname = window.location.pathname; jQuery.ajax({ url: pathname + "?format=json-pretty", dataType: "json", success: function (data) { sku = data.item.structuredContent.variants[0].sku; jQuery("#sku").html("<b>SKU:</b> " + sku); } }); }); </script> Link to comment
yuribtonani Posted March 30 Share Posted March 30 On 10/9/2021 at 2:34 PM, Sophik said: this is what i did to insert the SKU right below the price on a single product page (don't have this for category/list page)... hope it helps. <script> jQuery(document).ready(function() { jQuery("<div id='sku'></div>").insertAfter(".ProductItem-product-price" ); var pathname = window.location.pathname; jQuery.ajax({ url: pathname + "?format=json-pretty", dataType: "json", success: function (data) { sku = data.item.structuredContent.variants[0].sku; jQuery("#sku").html("<b>SKU:</b> " + sku); } }); }); </script> Hey Sophik! Sorry about for my ignorance.. but where should i insert this code? Advanced -> code injection? thanks Link to comment
tuanphan Posted April 2 Share Posted April 2 On 3/31/2023 at 1:32 AM, yuribtonani said: Hey Sophik! Sorry about for my ignorance.. but where should i insert this code? Advanced -> code injection? thanks Yes. Settings > Advanced > Code Injection > Footer Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
yuribtonani Posted April 3 Share Posted April 3 On 4/2/2023 at 5:22 AM, tuanphan said: Yes. Settings > Advanced > Code Injection > Footer you are AWESOME. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment