Literally just copied the code from the doc example
and on first run the compiler throws this
error[E0599]: no method named `is_none_or` found for enum `Option` in
the current scope
Literally just copied the code from the doc example
and on first run the compiler throws this
error[E0599]: no method named `is_none_or` found for enum `Option` in
the current scope
Hi - which code specifically did you copy? eg: which step were you on when you encountered this error?
This code:
use super::schema;
use shopify_function::prelude::*;
use shopify_function::Result;
#[shopify_function]
fn run(input: schema::run::Input) -> Result<schema::FunctionRunResult> {
let no_changes = schema::FunctionRunResult { operations: vec![] };
// Get the cart total from the function input, and return early if it's below 100
let cart_total: f64 = input.cart().cost().total_amount().amount().as_f64();
if cart_total < 100.0 {
eprintln!("Cart total is not high enough, no need to hide the payment method.");
return Ok(no_changes);
}
// Find the payment method to hide, and create a hide output operation from it
let operations = input
.payment_methods()
.iter()
.find(|&method| method.name() == "Cash on Delivery")
.map(|method| {
vec![schema::Operation::Hide(schema::HideOperation {
payment_method_id: method.id().to_string(),
placements: None,
})]
})
.unwrap_or_default();
Ok(schema::FunctionRunResult { operations })
}
Which version of the Shopify CLI are you using? If you’re not on the most recent, can you update and try again?