/*
Theme Name: Flatsome Child
Description: This is a child theme for Flatsome Theme
Author: UX Themes
Template: flatsome
Version: 3.0
*/

/*************** ADD CUSTOM CSS HERE.   ***************/


@media only screen and (max-width: 48em) {
/*************** ADD MOBILE ONLY CSS HERE  ***************/


}
add_action( 'woocommerce_check_cart_items', 'wc_minimum_order_amount_usd' );
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount_usd' );

function wc_minimum_order_amount_usd() {

    // Set minimum order amount here (in USD)
    $minimum = 150; // ← change this number (example: $150 minimum order)

    // Ensure the cart exists
    if ( ! WC()->cart ) {
        return;
    }

    // Get cart total
    $cart_total = WC()->cart->total;

    // If below minimum, block checkout & show error
    if ( $cart_total < $minimum ) {

        $message = sprintf(
            'Your current order total is %s — the minimum order is %s.',
            wc_price( $cart_total ),
            wc_price( $minimum )
        );

        if ( is_cart() ) {
            wc_print_notice( $message, 'error' );
        } else {
            wc_add_notice( $message, 'error' );
        }
    }
}