File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
extensions/product-discount/src Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -37,14 +37,18 @@ fn function(input: input::ResponseData) -> Result<output::FunctionResult> {
37
37
. collect :: < Vec < output:: Target > > ( ) ;
38
38
39
39
if targets. is_empty ( ) {
40
+ // You can use STDERR for debug logs in your function
41
+ eprintln ! ( "No cart lines qualify for volume discount." ) ;
40
42
return Ok ( no_discount) ;
41
43
}
42
44
43
45
// The shopify_function crate serializes your function result and writes it to STDOUT
44
46
Ok ( output:: FunctionResult {
45
47
discounts : vec ! [ output:: Discount {
46
48
message: None ,
49
+ // Apply the discount to the collected targets
47
50
targets,
51
+ // Define a percentage-based discount
48
52
value: output:: Value {
49
53
fixed_amount: None ,
50
54
percentage: Some ( output:: Percentage {
Original file line number Diff line number Diff line change 1
1
# This file stores configurations for your Shopify app.
2
2
3
- scopes = " write_products"
3
+ scopes = " write_products, write_discounts "
You can’t perform that action at this time.
0 commit comments