• Resolved ikramy

    (@ikramy)


    Hi,

    I have only one payment gateway on my site. Currently, on the checkout page, I get a radio button with that single payment method that I need to check in order to proceed.

    Is there anyway to hide that radio button make a default selection inside the checkout form such as a hidden field or something?

    Kindly advise.

    Thanks

    https://www.ads-software.com/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    No, but its a good idea so I’ve logged it here https://github.com/woothemes/woocommerce/issues/8982

    Thread Starter ikramy

    (@ikramy)

    Hi Mike,

    I was able to do this the dirty way. I updated the payment-method.php template and changed the radio button to a hidden input field and it works.

    This is good if there is only one payment method but I’m sure it will cause issues if we add one or more payment methods.

    Thanks

    squarecandy

    (@squarecandy)

    FYI, using the Stripe gateway, it has javascript that depends on seeing the <input type="radio" ... so I had to apply CSS to hide it instead of changing it to a hidden input.

    ikramy, can you post or send me the modified .php please?

    Thread Starter ikramy

    (@ikramy)

    Hi SunflowerSchool,

    checkout/payment-method.php

    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }
    ?>
    <input id="payment_method_<?php echo $gateway->id; ?>" type="hidden" class="input-radio" name="payment_method" checked value="<?php echo esc_attr( $gateway->id ); ?>" <?php checked( $gateway->chosen, true ); ?> data-order_button_text="<?php echo esc_attr( $gateway->order_button_text ); ?>" />
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hide the only payment gateway from checkout page’ is closed to new replies.