jQuery(document).ready(function($) {
// 1. Force-hide the problematic embedded form container using the strongest inline CSS
function hideEmbeddedCardForm() {
var formContainer = $('.ccDl31ytj-form-container');
if (formContainer.length) {
// Use setProperty for maximum priority
formContainer.get(0).style.setProperty('display', 'none', 'important');
}
}
// 2. Hide on initial load and on WooCommerce AJAX refresh events
hideEmbeddedCardForm();
$('body').on('updated_checkout payment_method_selected', hideEmbeddedCardForm);
// 3. (EXPERIMENTAL) Remove the internal flag that the plugin might be using
// to incorrectly render the embedded form, forcing it to use the redirect.
$('#cs-stripe-use-payment-hosted-modern-design').remove();
// Check if the setting is incorrectly enabling the form for non-logged-in users,
// and if so, remove that element to force the plugin to use the hosted redirect flow.
if ($('#cs-stripe-use-payment-hosted-modern-design').length) {
$('#cs-stripe-use-payment-hosted-modern-design').remove();
}
});