• Resolved Md Rasel Khan

    (@mdraselkhan)


    Here is my current code on a plugin.

    /**
         * Field Validation.
         */
        public function payment_process() {
            if ( 'woo_bkash' !== $_POST['payment_method'] ) {
                return;
            }
    
            $number   = sanitize_text_field( $_POST['bKash_acc_no'] );
            $trans_id = sanitize_text_field( $_POST['bKash_trans_id'] );
    
            if ( '' === $number ) {
                wc_add_notice( __( 'Please enter your bKash number.', 'bangladeshi-payment-gateways' ), 'error' );
            }
    
            if ( '' === $trans_id ) {
                wc_add_notice( __( 'Please enter your bKash transaction ID.', 'bangladeshi-payment-gateways' ), 'error' );
            }
        }

    I want to make these fields optional by adding code on the function.php file of the child theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi there,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Cheers.

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    We’ve not seen any activity on this thread for a while, so I’m marking it as resolved.

    Hopefully, you were able to find a solution and the above resources for developers were helpful. If you have further questions, please feel free to open a new topic.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to make WooCommerce payment method field optional?’ is closed to new replies.