Jump to content

How to automatically fill Product "Additional Info" field?

Recommended Posts

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
  • Replies 6
  • Views 900
  • Created
  • Last Reply

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

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

 @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
<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

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.