• Andrei

    (@andreizlamparet)


    Hello, I’ve implemented cash on delivery for specific country with this code:

    add_action( ‘woocommerce_after_single_product_summary’, ‘comments_template’, 50 );
    function payment_gateway_disable_country( $available_gateways ) {
    global $woocommerce;
    if ( isset( $available_gateways[‘cod’] ) && $woocommerce->customer->get_country() <> ‘RO’ ) {
    unset( $available_gateways[‘cod’] );
    }
    return $available_gateways;
    }
    add_filter( ‘woocommerce_available_payment_gateways’, ‘payment_gateway_disable_country’ );

    In this case, “Cash on delivery” is available only for Romania. I want to make “Cash on delivery” available only for shipping addresses located in Romania. The problem is that when I select COD, I still have both billing address and a shipping address. The billing address is useless because the person will pay at the shipping address. And if I select as billing address a location from Romania and as shipping address a location from Germany for example, Cash on delivery will still be available even if the product is shipped to Germany. What can I do to remove the billing address if I select Cash on delivery and to make COD available only for specific countries from the SHIPPING ADDRESS not the billing address.

    Thank you,
    Andrei

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cash on Delivery for specific country (shipping address)’ is closed to new replies.