Affirm Banner | Q2 2024

added by Latoya

Flash sale: Get up to 30% off themes and extensions. Ends April 26 at 3 pm UTC. Shop the sale.
Product Icon

WooCommerce One Page Checkout

Create special pages where customers can choose products, checkout & pay all on the one page.

Enhanced Selector for showHidePlaceOrder

I hope this message finds you well. I am writing to suggest a small yet impactful enhancement that I believe could significantly improve its compatibility and functionality across a wide range of themes and custom WooCommerce checkout page layouts.

Current Implementation:

Currently, the plugin’s JavaScript function showHidePlaceOrder determines the visibility of the “Place Order” button based on the presence of child elements within the #order_review tbody element. While this works well with standard WooCommerce templates, it may not perform as expected in custom themes or when the checkout layout is modified (e.g., when tbody is not used or structured differently).

Suggested Enhancement:

To increase the robustness and theme compatibility of the plugin, I propose modifying the selector used in the showHidePlaceOrder function from #order_review tbody to specifically target .cart_item elements within #order_review.
This approach is more flexible and allows for accurate detection of cart items regardless of the underlying HTML structure.

Proposed Implementation:

javascript

function showHidePlaceOrder() {
if ($(‘#order_review .cart_item’).length > 0) {
$(‘#place_order’).stop(true, true).show();
$(‘#payment .payment_methods’).show();
} else {
$(‘#place_order’).stop(true, true).hide();
$(‘#payment .payment_methods’).hide();
}
}

Author

cspoirier

Current Status

Open

Last updated: February 6, 2024

0 comments

Log in to comment on this feature request.