Skip to content

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

  1. Log in to your Shopify Admin
  2. Navigate to Apps > Script Editor
  3. Click "Create new script"
  4. 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

  1. Add a product to cart through your mobile app
  2. Proceed to checkout
  3. Verify that:
  4. The discount appears with the message "App Exclusive Discount"
  5. The correct discount amount is applied
  6. 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:

  1. Discount not appearing:
  2. Verify the Script Editor is properly installed
  3. Check that the property is being correctly added to cart items
  4. Ensure the script is published and active

  5. Wrong discount amount:

  6. Double-check the multiplication factor in the script
  7. 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

  1. Clear Communication:
  2. Clearly advertise the app-exclusive discount in your marketing
  3. Make the discount value obvious to users
  4. Explain how to get the discount (download and use the app)

  5. Strategic Implementation:

  6. Start with a compelling discount percentage
  7. Consider time-limited promotions
  8. Track usage and adjust based on performance

  9. Technical Considerations:

  10. Regular testing of the discount logic
  11. Monitoring for any conflicts with other promotions
  12. Keeping backup copies of working scripts

Support

Need help implementing app-only discounts? Our team is here to assist:

Custom Solutions

Need a more complex discount structure? Contact our team for custom implementation support.