Here is a function that you can use to Set a Minimum Order Amount in WooCommerce and display a custom error message if the minimum is not met:
This function will check the total value of the cart and, if it is less than the specified minimum, it will display an error message using the
wc_add_notice function. The message will be displayed on the cart and checkout pages.
You can customize the error message by changing the text inside the
sprintf function. The
%s placeholders will be replaced with the current cart total and the minimum order value, respectively.
You can also adjust the minimum order value by changing the value of the
I hope this helps! Let me know if you have any questions.