JS help with Woocommerce Checkout

In my checkout page, specifically in Payment Method selection, I don't want the 'Place Order' button to show up when the 'Financing' option is selected. I hope this can be done with some JS. Any help is highly appreciated.

  • Majid
    • Syntax Hero

    Hey Mike!
    I hope you are having a nice day :slight_smile:

    The following JS code will hide the place order button when financing is selected.

    <script type="text/javascript">
    	(function($) {
    		$(document).ready(function() {
              	var $form = $('form[name="checkout"]');
              	$form.on('click', 'input[name="payment_method"]', function() {
              	var val = $form.find('input[name="payment_method"]:checked').val(),
                $place_order = $form.find('#place_order');
                if( 'bread_finance' === val ) {
                  $place_order.hide();
                } else {
                	$place_order.show();
                }
              });
    		});
    	})(jQuery);
    </script>

    I already added that to a Custom JS plugin under Custom CSS & JS > All custom Code > Place order, this was a plugin I installed to quickly test the code, but you can move it somewhere else if you want :slight_smile:

    Cheers,
    Majid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.