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.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.