For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Hello everyone,
I just implemented a Shopify cart validation function. In the dev store the error is showing just once like in the Shopify docs. But when I activate it on the production store the error is always showing twice like on the screenshot. Does anyone of you already had the problem and knows how to disable on of this?
Best regards
Lukas
This is the TS code:
export function run(input: Input): FunctionRunResult {
const error: FunctionError = {
localizedMessage: "Du kannst aus der Schweiz nur Bestellungen bis 1000 € aufgeben.",
target: "cart"
};
const orderSubtotal: number = parseFloat(input.cart.cost.subtotalAmount.amount);
const errors: FunctionError[] = [];
if (orderSubtotal > 1000.0 && input.localization?.country?.isoCode == 'CH') {
errors.push(error);
}
return { errors };
};
Screenshot and text in english:
"Order information is missing or is invalid Call us or send us an email to update this information and complete your order: • You can only place orders up to €1000 from Switzerland."