Hi @true-deals ,
I am not sure I completely understand the motivation behind implementing something like this. Updating the price of the product will make the new product's price available to everyone who visits the store. A more robust approach would be to have multiple product variants for the same product that have the different prices. So when the customer clicks button X, they will just get the product variant with the different price. This is better than allowing one product to be updated by anyone who visits your store.
If you are adamant about going with this approach, know that the only way to update the price of the product is through the Shopify Admin API (either in REST or in GraphQL). However the Shopify Admin API can not be accessed from the front-end browser of a Shopify store front, it can only be accessed either through an embedded app on the Shopify web Admin or through a private app running on a back-end server. So with this in mind, to accomplish this you will need to 1) Add a new button the Product page via Liquid code, 2) Make it so when the button is pressed, it sends an API request to an app/microservice you have running on a back-end server, 3) From the app/microservice running on your backend server, make a request to the Shopify Admin API to update the price of the product.
Hassain | Developer Support Specialist @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution