This is quite a tricky one to debug as the problem occurs in the context of an entire page and I struggle to reproduce it in isolation. I will try and post as much relevant code as possible here though.
Essentially I have a dev WooCommerce WordPress store for which I have built a custom theme. On the checkout page there is the standard choice of payment options marked up as follows:
<ul class="payment_methods methods">
<li class="payment_method_bacs">
<div class="radio">
<label for="payment_method_bacs">
<input id="payment_method_bacs" type="radio" class="input-radio" name="payment_method" value="bacs" checked='checked' data-order_button_text="" />Direct Bank Transfer</label>
</div>
<div class="panel panel-default payment_box payment_method_bacs">
<div class="panel-body">
<p>Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order won’t be shipped until the funds have cleared in our account.</p>
</div>
</div>
</li>
<li class="payment_method_cheque">
<div class="radio">
<label for="payment_method_cheque">
<input id="payment_method_cheque" type="radio" class="input-radio" name="payment_method" value="cheque" data-order_button_text="" />Cheque Payment</label>
</div>
<div class="panel panel-default payment_box payment_method_cheque" style="display:none;">
<div class="panel-body">
<p>Please send your cheque to Store Name, Store Street, Store Town, Store State / County, Store Postcode.</p>
</div>
</div>
</li>
</ul>
The idea is that when a payment option radio button is selected the corresponding payment_box is shown. Upon referring to the plugin assets there is a jQuery snippet that achieves this:
payment_method_selected: function( e ) {
if ( $( '.payment_methods input.input-radio' ).length > 1 ) {
var target_payment_box = $( 'div.payment_box.' + $( this ).attr( 'ID' ) );
if ( $( this ).is( ':checked' ) && ! target_payment_box.is( ':visible' ) ) {
$( 'div.payment_box' ).filter( ':visible' ).slideUp( 250 );
if ( $( this ).is( ':checked' ) ) {
$( 'div.payment_box.' + $( this ).attr( 'ID' ) ).slideDown( 250 );
}
}
} else {
$( 'div.payment_box' ).show();
} //etc...
This script is included in my site scripts by WooCommerce in the normal way and there is nothing in the console indicating a problem but for some reason when a payment method radio is selected its corresponding box does not show.
I think the only way to demonstrate is to link to the site in question: http://ift.tt/1DQlDsM. Add a product to cart and visit http://ift.tt/1Hsn6TO.
If anyone can help me debug this I'll be enternally grateful!
Aucun commentaire:
Enregistrer un commentaire