Shopify cart validation error notice is showing twice on B2B store

Lukas50
Shopify Partner
2 0 0

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."

Bildschirmfoto 2023-11-04 um 13.04.14.png

Replies 0 (0)