Build a discounts experience
In this tutorial series, you'll use Shopify Functions to create a new discount type called "Volume discount" that offers a percentage off when customers purchase more than the minimum quantity of each product. You'll end up with a working discounts sample app to build your functionality.
What you'll learnAnchor link to section titled "What you'll learn"
In this tutorial series, you'll learn how to do the following tasks:
- Set up your environment to use functions.
- Create a product discount function.
- Add configuration to your product discount using metafields.
- Build a product discount user interface with App Bridge.
RequirementsAnchor link to section titled "Requirements"
- You've created a Partner account.
- You've created a development store.
- You've created an app that uses Shopify CLI 3.0 or higher, or you've migrated your existing app so that it's compatible with Shopify CLI 3.0 or higher.
- You've installed your app on the development store.
Rust-specific requirementsAnchor link to section titled "Rust-specific requirements"
The following requirements are specific to Rust-based development with Shopify Functions.
You've installed Rust.
On Windows, Rust requires the Microsoft C++ Build Tools. Make sure to select the Desktop development with C++ workload when installing the tools.
You've installed cargo-wasi:
Sample codeAnchor link to section titled "Sample code"
If you want to quickly get started, then you can get the sample code by completing the following steps. The tutorial series describes the sample code step by step.
Clone the discount sample app:
Enter a name for your app project.
Navigate to your app directory:
Deploy your app and function:
Start a local server for your app:
With the server running, open the Preview URL in the terminal output.
When you open the URL, you're prompted to install the app on your development store.
Click Install app to install the app on the store.
Tutorial seriesAnchor link to section titled "Tutorial series"
Follow the tutorial series to go from "Hello World" to a fully built out discounts experience.
Tutorial 1: Getting started with building a discounts experience
Create a new product discount function.
Tutorial 2: Add configuration to your discounts experience
Add configuration to your product discount using metafields.
Developer tools and resourcesAnchor link to section titled "Developer tools and resources"
Explore the following developer tools and resources to get familiar with building discount experiences.
- Get started with building a discounts experience.