LKW Posted October 11, 2020 Share Posted October 11, 2020 Hello all, I need to add 145 new products that all have the same content in their "Additional Info" field. Is there a way to make that content appear with code injection? The content I would like to add is just static HTML text. I have the "advanced commerce" plan and have been experimenting with bulk-loading products from .csv, but there is no field in the .csv file for Additional Info. 😞 Your help is appreciated!  Link to comment
LKW Posted October 12, 2020 Author Share Posted October 12, 2020 I've created an example here:https://www.whitprint.com/product-staging/testy Password is "tada". Look for the string "Abracadabra shazaam!" That is where I would like to insert text via code injection. Link to comment
tuanphan Posted October 12, 2020 Share Posted October 12, 2020 Add to Home > Settings > Advanced > Code Injection > Footer <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> jQuery(document).ready(function($) { $('<p>tuan phan tuan phan tuan phan</p>').appendTo(".product-description"); }); </script>  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
LKW Posted October 12, 2020 Author Share Posted October 12, 2020 Bwahahaha... @tuanphan, you nailed it. I put your snippet in the Advanced>Page Header Code Injection of the Product page, not in Home>Settings, so it wouldn't impact our other products. It works great. I also tried replaceAll instead of appendTo and that works as well. Your teeny bit of code has opened up a new world to me. Thanks, Tuan!  Link to comment
LKW Posted October 12, 2020 Author Share Posted October 12, 2020  @tuanphan I just realized this doesn't solve my actual problem, because in my example I had already added text in the product's Additional Info field. So this only works if I've manually created Additional Infos for all my products, which is what I'm trying to avoid. Here's a new product that doesn't have any Additional Info:https://www.whitprint.com/product-staging/cranky Any thoughts on how to insert text below the product info of this one? (I tried a bit of amateurish hacking but nothing worked.) Also, as I mentioned, I don't want this to affect my whole site, so I'm hoping there's something I can inject on the Product page itself. Thanks much!  Link to comment
tuanphan Posted October 13, 2020 Share Posted October 13, 2020 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> jQuery(document).ready(function($) { $('<p>tuan phan tuan phan tuan phan</p>').insertAfter("div#productSummary"); }); </script>  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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.