Replies: 7 comments 4 replies
-
Hello
// Disable AJAX Cart
function register_ajax_cart() {
}
add_action('after_setup_theme', 'register_ajax_cart');
<!-- Mini cart toggler -->
<?php
if ( is_cart() ) {
// Do nothing
} elseif ( is_checkout() ) { ?>
<!-- Add a back-to-cart button -->
<a class="btn btn-outline-secondary ms-1 ms-md-2" href="<?= wc_get_cart_url() ?>">
<i class="fa-solid fa-arrow-left d-none d-md-inline me-2"></i><i class="fa-solid fa-bag-shopping"></i><span class="visually-hidden-focusable">Return to Cart</span>
</a>
<?php
} else { ?>
<!-- Add mini-cart toggler -->
<button class="btn btn-outline-secondary ms-1 ms-md-2 position-relative" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvas-cart" aria-controls="offcanvas-cart">
<i class="fa-solid fa-bag-shopping"></i><span class="visually-hidden-focusable">Cart</span>
<?php if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
$count = WC()->cart->cart_contents_count;
?>
<span class="cart-content">
<?php if ($count > 0) { ?>
<?= esc_html($count); ?>
<?php
}
?></span>
<?php } ?>
</button>
<?php } ?> Replace it with following: <!-- Mini cart toggler -->
<?php
if ( is_cart() ) {
// Do nothing
} elseif ( is_checkout() ) { ?>
<!-- Add a back-to-cart button -->
<a class="btn btn-outline-secondary ms-1 ms-md-2" href="<?= wc_get_cart_url() ?>">
<i class="fa-solid fa-arrow-left d-none d-md-inline me-2"></i><i class="fa-solid fa-bag-shopping"></i><span class="visually-hidden-focusable">Return to Cart</span>
</a>
<?php
} else { ?>
<!-- Add mini-cart toggler -->
<a href="<?= wc_get_cart_url() ?>" class="btn btn-outline-secondary ms-1 ms-md-2 position-relative">
<i class="fa-solid fa-bag-shopping"></i><span class="visually-hidden-focusable">Cart</span>
<?php if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
$count = WC()->cart->cart_contents_count;
?>
<span class="cart-content">
<?php if ($count > 0) { ?>
<?= esc_html($count); ?>
<?php
}
?></span>
<?php } ?>
</a>
<?php } ?> Now Ajax cart is disabled and mini-cart button in header links to the cart page. Solved? |
Beta Was this translation helpful? Give feedback.
-
Hi Basti, Thanks for your quick reply. Does
disable WooCommerce's AJAX cart completely? I would only need to disable bootScore's ajax cart. I need to keep the notion of the AJAX cart, just not the bootScore's built-in offcanvas one so that it doesn't conflict with the other plugin. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hi, Me again. When I make the suggested changes, the bootScore side cart no longer appears, but this doesn't solve my problem. BootScore continues to inject code into CheckoutWC's side cart. I need to completely remove/deregister the whole notion/existence of the bootScore side cart, not just the data targets that prompt bootScore's offcanvas cart. Thank you very much for your help! |
Beta Was this translation helpful? Give feedback.
-
Hi, Thanks. However, some elements from bootScore's mini cart / offcanvas cart are still injected into CheckoutWC, as you can see on the attached screenshot. Website is infdepoche.com. ![]() Thank you. |
Beta Was this translation helpful? Give feedback.
-
And the bootScore's "spinner" also injects into CheckoutWC's cart, which seems to cause a conflict (perpetual loading spinner + blank side cart after a page refresh), as you can see here: Enregistrement.d.ecran.le.2024-03-22.a.15.29.24.mov |
Beta Was this translation helpful? Give feedback.
-
Thank you for these explanations. I thought the problem was coming from bootScore, but you seem to be saying that the problem lies with the plugin. I prefer to avoid hiding things via CSS as much as possible. I'll discuss it with the plugin's author. |
Beta Was this translation helpful? Give feedback.
-
Hi Basti, In fact, there are two main problems. There's the problem with the buttons, but there's also the problem with bootScore's AJAX loader, which appears in CheckoutWC's side cart, even when bootscore's AJAX is disabled with the code you gave me above. In fact, I don't want to eliminate all bootscore AJAX, I just don't want bootScore elements to take over CheckoutWC elements. bootScore's AJAX white screen with a spinner appears in CheckoutWC's side cart on every WooCommerce page. This can be reproduced when changing quantity or removing an item in the side cart. This happens even after I disable bootScore's side cart and bootScore's AJAX. When CheckoutWC's side cart is enabled, it also seems to cause conflicts that cause the bootScore spinner to load infinitely when a product is added to the cart. Here’s CheckoutWC’s side cart AJAX loading effect that is showing correctly on the home page, on non-WooCommerce pages, and on blog posts: Here’s bootScore’s white screen with a blue spinner that takes over CheckoutWC’s side cart AJAX loading effect on all WooCommerce pages: It seems that either bootScore forces these elements and/or CheckoutWC loads these elements and/or there is no mechanism to prevent the loading of elements other than CheckoutWC's own. After discussing with the authors of CheckoutWC, they tell me the following information:
Please let me know your thoughts on this. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hello,
I use the CheckoutWC plugin, which has its own side cart. Unfortunately, it conflicts with the sidecart/offcanvas cart from bootScore. Could you tell me how to completely disable the notion of sidecart/offcanvas cart from bootScore?
Thank you for your help.
Beta Was this translation helpful? Give feedback.
All reactions