Woocommerce output in the header count. pending items ajax?

How to implement? The problem I have is that if I insert a div with the class .cart-contents displays a ajax updated facilities, but I can't even find where to edit such a conclusion. In General, how to display just the count of orders with ajax?
June 14th 19 at 21:04
1 answer
June 14th 19 at 21:06
Here is a working example.

functions.php :

 * Cart Fragments.
 * Ensure cart contents update when products are added to the cart via AJAX.
 * @param array $fragments Fragments to refresh via AJAX.
 * @return array Fragments to refresh via AJAX.
 my_woocommerce_cart_link_fragment function( $fragments ) {
 $fragments['#header-cart-contents'] = ob_get_clean();

 return $fragments;
add_filter( 'woocommerce_add_to_cart_fragments', 'my_woocommerce_cart_link_fragment' );

 * Cart Link.
 * Displayed a link to the cart including the number of items present and the cart total.
 * @return void
 my_woocommerce_cart_link function() {
 <div id="header-cart-contents" class="header-cart">
 <span><?= wp_kses_data( WC()--->cart->get_cart_contents_count());?></span>
 <a href="<?php echo esc_url( wc_get_cart_url() ); ?>"><img src="<?= get_template_directory_uri();?>/img/header-cart.png" alt="shop-cart"></a>
br><br> In the template, in the right place cause <code>my_woocommerce_cart_link();</code><br> The markup change for themselves. The main thing is that <pre><code>$fragments['#header-cart-contents'] = ob_get_clean();</code></pre> Definitely had the right selector your unit with basket<br><br> Full list of class methods WC_Cart <a href="https://docs.woocommerce.com/wc-apidocs/class-WC_Cart.html" rel="nofollow" target="_blank">https://docs.woocommerce.com/wc-apidocs/class-WC_C...</a><br> To access it through WC()->cart, as in the example
Thank you very much! Can I still the little things you have to know? I connected the shopping cart page and payment. But now there is a problem, when you go to the page it skrollitsya down on the form. With what may be causing the problem? (I can throw a link, but don't want her here to Shine) - sim31 commented on June 14th 19 at 21:09
well perhaps you have a link to the checkout page with an anchor-type "/checkout/#form' or some js on the page with checking out code works.. view - aaron commented on June 14th 19 at 21:12

Find more questions by tags WooCommerceWordPress