MCPcopy Create free account
hub / github.com/Shopify/function-examples / run

Function run

discounts/rust/order-discounts/default/src/run.rs:17–32  ·  view source on GitHub ↗
(input: input::ResponseData)

Source from the content-addressed store, hash-verified

15
16#[shopify_function_target(query_path = "src/run.graphql", schema_path = "schema.graphql")]
17fn run(input: input::ResponseData) -> Result<output::FunctionRunResult> {
18 let no_discount = output::FunctionRunResult {
19 discounts: vec![],
20 discount_application_strategy: output::DiscountApplicationStrategy::FIRST,
21 };
22
23 let _config = match input.discount_node.metafield {
24 Some(input::InputDiscountNodeMetafield { value }) => Configuration::from_str(&value),
25 None => return Ok(no_discount),
26 };
27
28 Ok(output::FunctionRunResult {
29 discounts: vec![],
30 discount_application_strategy: output::DiscountApplicationStrategy::FIRST,
31 })
32}
33
34#[cfg(test)]
35mod tests {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected