• am using WooCommerce and I have a custom checkout field in form of a selection list. I am trying to remove COD gateway, when customer select on a custom checkout field a specific option (“newyork” in this case).

    Here below is my actual code where I don’t know how to make the IF statement condition part working:

    add_filter(‘woocommerce_available_payment_gateways’, ‘woocs_filter_gateways’, 1);

    function woocs_filter_gateways($gateway_list)
    {
    if ( order_meta key=”wc_billing_field_7378″ value = newyork )
    {
    unset($gateway_list[‘cod’]);
    }

    return $gateway_list;
    }
    How can I get the selected value of my custom checkout field In my code, to get my IF statement working?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to use custom checkout field in code’ is closed to new replies.