App Only Discounts¶
Offer exclusive discounts to your mobile app users using Shopify Scripts. This feature automatically applies special discounts at checkout for products added through your mobile app, helping drive app adoption and increase mobile sales.
Prerequisites¶
Shopify Plus Required
App-only discounts require a Shopify Plus account as they utilize Shopify Scripts functionality.
Before you begin, ensure you have: - A Shopify Plus account - Script Editor app installed from the Shopify App Store - Your Appora mobile app configured to support line item properties
How It Works¶
The app-only discount system works in two parts: 1. Your mobile app tags items added to cart with a special property 2. A Shopify Script detects these tagged items and applies the discount automatically
Implementation Guide¶
1. Configure Your Mobile App¶
When customers add products to their cart through your mobile app, we'll attach a unique property to identify it. Here's how the cart addition is structured:
fetch('/cart/add.js', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: PRODUCT_ID,
quantity: 1,
properties: {
'app_discount': 'true'
}
})
});
2. Set Up Script Editor¶
- Log in to your Shopify Admin
- Navigate to Apps > Script Editor
- Click "Create new script"
- Select "Line Item Script"
3. Add the Discount Script¶
Copy and paste this Ruby script into the Script Editor:
Input.cart.line_items.each do |line_item|
if line_item.properties.has_key?("app_discount")
new_price = line_item.line_price * 0.90 # 10% off
line_item.change_line_price(new_price, message: "App Exclusive Discount")
end
end
Output.cart = Input.cart
4. Customize Your Discount¶
You can modify the script to: - Change the discount percentage (e.g., * 0.85
for 15% off) - Use different property keys (e.g., source: 'appora'
) - Add conditions for specific products or collections - Customize the discount message
Testing¶
- Add a product to cart through your mobile app
- Proceed to checkout
- Verify that:
- The discount appears with the message "App Exclusive Discount"
- The correct discount amount is applied
- Products added from other sources (website, admin) don't receive the discount
Testing Tip
Test the discount with various product combinations and ensure it works with other promotional offers.
Troubleshooting¶
Common issues and solutions:
- Discount not appearing:
- Verify the Script Editor is properly installed
- Check that the property is being correctly added to cart items
-
Ensure the script is published and active
-
Wrong discount amount:
- Double-check the multiplication factor in the script
- Verify there are no conflicting discount scripts
Future Updates¶
Important: 2026 Migration
Shopify Scripts will be deprecated in 2026. We are actively developing a Shopify Functions alternative and will provide a seamless migration path before the deprecation date.
Best Practices¶
- Clear Communication:
- Clearly advertise the app-exclusive discount in your marketing
- Make the discount value obvious to users
-
Explain how to get the discount (download and use the app)
-
Strategic Implementation:
- Start with a compelling discount percentage
- Consider time-limited promotions
-
Track usage and adjust based on performance
-
Technical Considerations:
- Regular testing of the discount logic
- Monitoring for any conflicts with other promotions
- Keeping backup copies of working scripts
Support¶
Need help implementing app-only discounts? Our team is here to assist:
- Email: admin@appora.ca
Custom Solutions
Need a more complex discount structure? Contact our team for custom implementation support.