andymallinsphotography Posted January 29, 2022 Posted January 29, 2022 Site URL: https://andymallinsphotography.com Hi, Is it possible to inject Javascript on the cart page, currently I can do this on all my pages using the page header code injection for my Trustpilot widget but as the cart page is not static I have no such option. Thanks, Andy
Solution paul2009 Posted January 29, 2022 Solution Posted January 29, 2022 (edited) On 1/29/2022 at 9:58 PM, andymallinsphotography said: Is it possible to inject Javascript on the cart page, currently I can do this on all my pages using the page header code injection for my Trustpilot widget Instead of injecting code on each page individually, you can inject it to all pages via the site Code Injection panel. Code added here will apply to most* pages, including the cart page. *It will not apply to the Checkout page, Lock Screen or Cover Pages. Did this help? Please give feedback by clicking an icon below ⬇️ Edited December 11, 2023 by paul2009 edited for clarity andymallinsphotography 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
andymallinsphotography Posted January 29, 2022 Author Posted January 29, 2022 9 minutes ago, paul2009 said: Instead of injecting code on each page individually, you can inject it to all pages via the site code injection panel in Settings > Advanced > Code Injection. This will include the cart page. thank you! that sorted it, no idea why I hadn't thought of this as using it for other code! Thanks again, I've also got another question around resizing the cart view on mobile, any help on that one to would be greatly appreciated! Thanks again.
pixels Posted December 11, 2023 Posted December 11, 2023 Is there a way to add a code snippet that only applies to the shopping cart page?
paul2009 Posted December 11, 2023 Posted December 11, 2023 1 hour ago, pixels said: Is there a way to add a code snippet that only applies to the shopping cart page? You should add the code in the usual place (the Custom CSS panel for CSS or the Code Injection panel (for JavaScript or HTML) and then target your code, through the use of selectors, to ensure it only applies to the cart page. For example, the ID "#cart". Did this help? Please give feedback by clicking an icon below ⬇️ Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment