Varying product price when adding to cart

5 0 0


I'm working on an app that allows merchants to add a checkbox to the cart page where a customer can select whether or not to include an item in their cart. While I've figured out how to create the checkbox on the cart page and use it to add a product to the cart, I was wondering if there is a way for me to change the price of the product based on the total cart price (% of the total cart price)? I'm using the liquid templating language to update the cart to include the product.

Thank you!

Shopify Partner
347 25 51

Hi @shivanshinamdar ,


Welcome to the community!

Pretty sure you can't change the cart totals with Liquid syntax in your template. What you can do is either dynamically or have already created discount codes that you could apply to the cart using a GET request to shop URL: . Dynamic discount codes can either be setup with Shopify's Automatic Discounts or by creating an app proxy then creating discount codes using REST API. 


All the best with your app. 





Custom Apps and Themes Support | Email us: | Follow us on Twitter @achieveapplabs | New Monthly Support by Achieve Applabs
1 Like