Custom Error Messages for ValidateLine Events

When shoppers on your site generate an error in a validateLine event, you can customize the error message on your site using customized website text, and a JavaScript alert.

Shows how custom website text displays on your site.

Custom website text is applied to the bold text in the screenshot above. Use a JavaScript alert in your script to print the text in the second line.

To create a custom error message for validateLine events:

  1. Add the logic for conditions that will trigger the error in your script attached to the scriptable template sales order form.

    Include the alert in your script. Note the code sample below:

                       alert("Sorry-this item is on-hold due to safety issues.");
       return false; 
    
                  
  2. Go to Commerce > Site Builder > Content > Customize Text.

  3. Click the Headings subtab. Find the field containing the text, “There is a problem with your order.”

  4. Edit the text by adding content for the error message you want to display on your site.

  5. Click Save.

Related Topics

General Notices