This is a template for building a Cart Transform Function that applies dynamic line item pricing based on the line item quantity added to the cart. This app does not include an app home UI.
It contains the basics for building a Shopify app that uses only app extensions.
(https://shopify.dev/docs/apps/getting-started)
(https://shopify.dev/docs/api/functions/reference/cart-transform)
- You must download and install Node.js if you don't already have it.
- You must create a Shopify partner account if you don’t have one.
- You must create a store for testing if you don't have one, either a development store or a Shopify Plus sandbox store.
git clone https://github.com/nf-shopify/bulk-pricing.git
You can find function within /extensions/bulk-pricing-function
- Creation of a json metafield on the varirant object to contain bulk pricing - namespace: "custom", key: "bulk_prices"
{
"bulkPrices":[
{
"quantity":1,
"price":"399.99"
},
{
"quantity":4,
"price":"299.99"
},
{
"quantity":6,
"price":"199.99"
},
{
"quantity":8,
"price":"99.99"
}
]
}
The Shopify CLI connects to an app in your Partners dashboard. It provides environment variables and runs commands in parallel..
You can develop locally using your preferred package manager. Run one of the following commands from the root of your app.
Using npm:
npm run dev
Open the URL generated in your console. Once you grant permission to the app, you can start to to test the function in your store.