Modify Product Page via API

Highlighted
New Member
2 0 0

How do add a button or modify a button on the product page for some selected products?

0 Likes
Shopify Staff
Shopify Staff
1013 67 134

Hello there! 

 

You don't need to use the API to do this, this could be done with some work to your theme. Because of that, I've moved you over to our design forums where people a little more well-versed in this area will be able to chime in. Happy coding!

0 Likes
New Member
2 0 0

You don't understand, I want my app to be able to do that. 

0 Likes
Shopify Staff
Shopify Staff
1013 67 134

Hey again @parkerproject , apologies for the misunderstanding. 

 

You could also use the API to change a theme and edit products to accomplish this. 

 

With the Asset API you could create a new product template within a theme that uses different code than the standard product page does, and then add whatever theme code you need to it to add or modify the button(s) that you want. But the code you would need to duplicate or edit would vary pretty wildly depending on the theme, so there isn't really a way to give instruction further than that. 

 

Then, using the Product API once you have your theme code all sorted out, you can update any products you want to show your edited/added buttons by setting the 'template_suffix' value on a product so that it points to the template you created. That would allow you to toggle your custom buttons on a select group of products. 

 

Otherwise, you could also look into using the ScriptTag API to load an externally hosted custom script onto a shop that could potentially target specific products and display custom features on a page using JS. 

0 Likes