Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pfc101

    (@pfc101)

    Thanks for the code, however, it broke my site and after digging to find out the issue.
    It was showing an error on the line marked with ***…***. (Unexpected T_Function)

    Any ideas?

    Thank you

    add_action(‘woocommerce_before_cart’, ‘warp_minimum_order_amount’);
    add_action(‘woocommerce_before_checkout_form’, ‘warp_minimum_order_amount’);

    *** function warp_minimum_order_amount() { ***
    // Set this variable to specify a minimum order value
    $minimum = 20;
    if(is_wallet_rechargeable_cart()){
    return;
    }

    if (WC()->cart->subtotal < $minimum) {
    if (is_cart() || is_checkout()) {
    wc_print_notice(
    sprintf(esc_html__(‘Your current order total is %s — you must have an order with a minimum of %s to place your order’, ‘your text domain’),
    wc_price(WC()->cart->subtotal),
    wc_price($minimum)
    ), ‘error’
    );
    }
    }
    }

    add_action(‘woocommerce_checkout_process’, function() {
    // Set this variable to specify a minimum order value
    $minimum = 20;
    if(is_wallet_rechargeable_cart()){
    return;
    }
    if (WC()->cart->subtotal < $minimum) {
    throw new Exception(sprintf(esc_html__(‘Your current order total is %s — you must have an order with a minimum of %s to place your order’, ‘your text domain’),
    wc_price(WC()->cart->subtotal),
    wc_price($minimum)
    ));
    }
    });

    Thread Starter pfc101

    (@pfc101)

    Found the problem, it was a plugin issue

Viewing 2 replies - 1 through 2 (of 2 total)