• Resolved ssrw

    (@rwps)


    Is there a way to make the PO Number Required rather than optional?

    Please advise and thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hari

    (@harirymera)

    Hi there, @rwps.

    Yes, you can. The current version of the plugin doesn’t have the setting to do so. But, we’ve made a custom snippet below for you to make the PO Number required instead of optional.

    add_action( 'woocommerce_after_checkout_validation', 'igfw_po_number_required_on_checkout', 10, 2 );
    function igfw_po_number_required_on_checkout( $data, $errors ){
        if (
            $data['payment_method'] === 'igfw_invoice_gateway' &&
            get_option('igfw_enable_purchase_order_number') == 'yes' &&
            ( ! isset( $_POST['igfw_purchase_order_number'] ) || empty( $_POST['igfw_purchase_order_number'] ) )
        ) {
            $errors->add( 'billing_po_number_error', __( 'Please enter a PO Number.', 'invoice-gateway-for-woocommerce' ) );
        }
    }
    
    add_filter( 'igfw_purchase_order_number_title', 'igfw_po_number_title_on_checkout' );
    function igfw_po_number_title_on_checkout( $title ){
        return __( 'Purchase Order (required)', 'invoice-gateway-for-woocommerce' );
    }

    Also, thanks for using our plugin and let me know how it goes.

    Cheers!

    Plugin Support Fauzan Azizie

    (@fauzanade)

    Hi @rwps,

    Currently, there is no option to make the PO field required or modify available filters. So, unfortunately, I am unable to provide custom snippets.

    I’ll raise a feature request for this with our development team but please keep in mind that we aren’t able to provide any ETAs when it’ll be developed or made.

    In the meantime, let us know if you have other questions.

    Cheers,

    Thread Starter ssrw

    (@rwps)

    @harirymera

    Thank you! That worked well!

    I have another question but I’ll start a new topic for that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Make Purchase Order Number Required’ is closed to new replies.