• Resolved Dmitry

    (@onelawyer)


    After payment and return to the site mini cart is not cleared of goods, clear button does not work
    Page: /checkout/order-received/
    // Mini cart /wp-content/plugins/woocommerce/templates/cart/mini-cart.php

    
    <div class="mini-cart" style="height:70px;"> <a href="/cart/" title="View your shopping cart"> <span class="woo_mini-count flaticon-shopcart-icon"><span>1</span></span>
        </a>
        <div class="woo_mini_cart">
            <ul class="woocommerce-mini-cart cart_list product_list_widget ">
                <li class="woocommerce-mini-cart-item mini_cart_item">
                    <a href="/cart/?remove_item=196a7d2998b77fb1abba07ee832a9726&_wpnonce=4622d0b17e">×</a> <a href="/wttt/twtt/?attribute_pa_integrate-template-in-cms=html-css-js">
                        <img width="540" height="405" src="/wp-content/uploads/2018/11/43533-1-1-540x405.png" alt="Информационный сайт для компании" />Информационный сайт для компании - HTML, CSS, JS </a>
                    <span class="quantity">1 × <span class="woocommerce-Price-amount amount">5?<span class="woocommerce-Price-currencySymbol">?</span></span></span> </li>
            </ul>
            <p class="woocommerce-mini-cart__total total"><strong>Подытог:</strong> <span class="woocommerce-Price-amount amount">5?<span class="woocommerce-Price-currencySymbol">?</span></span></p>
            <p class="woocommerce-mini-cart__buttons buttons"><a href="/cart/">Просмотр корзины</a><a href="/checkout/">Оформление заказа</a></p>
        </div>
    </div>
    

    // Payment Gateway

    
    	/**
    	* Check Response
    	**/
    	function check_ipn_response(){
    		global $woocommerce;
    
    		if (isset($_GET['yandex']) AND $_GET['yandex'] == 'success'){
    		    
    			if(isset($_GET['yorder'])){
    				
    				$update_order_id = (int)$_GET['yorder'];				
    				$order_object = wc_get_order($update_order_id);
    				$order_object->update_status('completed');
    
    			}
    			
    			WC()->cart->empty_cart();
    
         
    			wp_redirect( $this->get_return_url( $order ) );
    		}
    	}
    
    • This topic was modified 5 years, 11 months ago by Dmitry.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Dmitry

    (@onelawyer)

    Prompt the solution of a problem

    Plugin Support AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    If the mini cart is not clearing, that typically means that the issue is with the server/site caching that’s in place. Here’s a guide on configuring that so that you should have no more issues.

    https://docs.woocommerce.com/document/configuring-caching-plugins/

    Thread Starter Dmitry

    (@onelawyer)

    Disabled caching on the website and the server, cleaned the cache, the problem remains ((( actually in the basket or what not, does not work after the payment:

    
    function wc_mini_cart_refresh( $fragments ) {
    			global $woocommerce;
    			ob_start();
    				?>
    					<span class='woo_mini-count flaticon-shopcart-icon'><?php echo ((WC()->cart->cart_contents_count > 0) ?  '<span>' . esc_html( WC()->cart->cart_contents_count ) .'</span>' : '') ?></span>
    				<?php
    				$fragments['.woo_mini-count'] = ob_get_clean();
    
    				ob_start();
    				woocommerce_mini_cart();
    				$fragments['div.woo_mini_cart'] = ob_get_clean();
    
    				return $fragments;
    		}	
    
    
    Thread Starter Dmitry

    (@onelawyer)

    It may be useful to anyone but there was a problem with wc-cart-fragments and SessionStorage:

    
    wc-cart-fragments'          => array(
    				'src'     => self::get_asset_url( 'assets/js/frontend/cart-fragments' . $suffix . '.js' ),
    				'deps'    => array( 'jquery', 'js-cookie' ),
    				'version' => WC_VERSION,
    			)
    
    

    you need to disable the connection of this script:

    
    add_action( 'wp_print_scripts', 'de_script', 100 );
    
    function de_script() {
        wp_dequeue_script( 'wc-cart-fragments' );
    
        return true;
    }
    
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cleaning the mini cart after payment’ is closed to new replies.