Using Shopify Scripts for line item discounts
If you are a Shopify Plus merchant, you may want to utilize Shopify Scripts to automatically apply a different discount to the cost of each product. Currently, the Recharge Checkout is not compatible with Shopify Scripts.
This guide explains why Shopify Scripts are incompatible with Recharge, and potential workarounds to employ.
- Recharge Checkout on Shopify
- Shopify Checkout Integration (Shopify Scripts have limited functionality with the Shopify Checkout Integration. Contact Shopify Support directly for more information).
Shopify Scripts and Recharge
Shopify Scripts do not work with the Recharge Checkout and subscription products.
The Recharge Checkout is dependent on the data that is present in the cart.json
to render the correct subscription properties for subscription products.
When Shopify Scripts are used, the necessary data to create the order does not show up in the cart.json
resulting in the creation of incorrect orders.
Limitations
The results of Shopify Scripts applied to subscription products can vary and issues may occur as a result of applying Shopify Scripts to a subscription product:
- The total cart value at the checkout may display the discounted amount, but each line item still shows the full price.
- The order total reported on the Orders Page in Shopify will show an incorrect amount even if the charge amount at the checkout may display the correct discounted amount.
- The discounted amount may apply to the first subscription product processed through the checkout but will not remain on the recurring orders.
Alternative methods
Utilize either of the following methods to apply line-item discounts to subscription products.
Method 1 - Update the product price within the Shopify admin
Edit the product price for each individual product in Shopify to ensure that each product has a separate discounted price attributed.
Method 2 - Custom code
Use custom JavaScript and Liquid code on the cart page to determine what product is in the cart, and apply any discount codes automatically once the customer proceeds to the checkout. For more information, check out the guide to applying a discount code to the checkout automatically.