Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi there,
I'm working on an app for try-before-you-buy logic. As part of that, I need to customize a few different areas of a customer's theme (also see docs here😞
For example, if I want to show a line item as $0 in the cart because it's a free trial, it looks like I would need to copy-paste ~400 lines of code from the "main-cart-items.liquid" and then another ~400 lines from the "main-cart-items.liquid" (Dawn theme) into my app code just so that I can update one line.
This doesn't seem like a very maintainable pattern. How can I as an app developer ever be sure that my copy-pasted code will work across themes?
What am I missing?
Utilize theme hooks: Some themes provide hooks or events that you can tap into to inject your app's functionality without modifying the theme's code directly. By utilizing theme hooks, you can add your custom logic and modify specific areas without the need for extensive code duplication.
Provide instructions for manual theme modifications: In cases where customization options are limited, you can provide detailed instructions to the merchant on how to modify their theme's code manually.
Thanks for the quick reply. I have a couple of follow-up questions:
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025