Home Forums Plugins CURCY – WooCommerce Multi Currency How to limit your payment method to purchases above a certain amount on WooCommerce

How to limit your payment method to purchases above a certain amount on WooCommerce

  • Author
    Posts
  • #78981

    farhad hakimian
    Participant

    I want cod payment to be opened when the country was on Hungary and the total payment price ((was above 100,000Ft)) This is my code
    But this code does not work with your plugin
    what solution do you suggest?

    add_filter( ‘woocommerce_available_payment_gateways’,’countrys_based_payment_gateway_cod’ );
    function countrys_based_payment_gateway_cod( $payment_gateways ) {
    if ( is_admin() ) return $payment_gateways; // Not on admin

    $customer_country = WC()->customer->get_shipping_country() ? WC()->customer->get_shipping_country() : WC()->customer->get_billing_country();
    $cart_total_excl_vat = WC()->cart->get_total(false);

    if ($cart_total_excl_vat >= 100000

You must be logged in to see replies to this topic. Click here to login or register