function onAddedToCart( event, fragments, cart_hash, $button ) {
			var key = 'div.widget_shopping_cart_content';
			var sku = $button.data( 'product_sku' );

			if ( key in fragments ) {
				$body.one( 'wc_fragments_loaded', function() {
					var $fragment = $( key );
					var $productList = $fragment.find( '.product_list_widget' );
					var $product = $productList.find( '[data-product_sku="' + sku + '"]' ).closest( '.mini_cart_item' );

					if ( $product.length ) {

						// scroll the newly added product into view
						if ( document.documentElement.scrollIntoView ) {
							$product.get(0).scrollIntoView();
						}

						// prepare the fade-in animation for the updated product in the cart
						$product.addClass( 'mini_cart_item--hidden' );

						// trigger the animation to show the updated product shortly after the cart slides into view
						setTimeout( function() {
							$product.removeClass( 'mini_cart_item--hidden' );
						}, 100 )
					}
				});
			}

			$button.text( pixelgradeWooCommerceStrings.added_to_cart );

			$( '.c-mini-cart' ).addClass( 'c-mini-cart--visible' );
		}
// show mini cart when a product is added to cart
show mini cart when a product is added to cart
show mini cart when a product is added to cart
function onAddedToCart( event, fragments, cart_hash, $button ) {
			var key = 'div.widget_shopping_cart_content';
			var sku = $button.data( 'product_sku' );
			if ( key in fragments ) {
				$body.one( 'wc_fragments_loaded', function() {
					var $fragment = $( key );
					var $productList = $fragment.find( '.product_list_widget' );
					var $product = $productList.find( '[data-product_sku="' + sku + '"]' ).closest( '.mini_cart_item' );
					if ( $product.length ) {
						if ( document.documentElement.scrollIntoView ) {
							$product.get(0).scrollIntoView();
						}
						$product.addClass( 'mini_cart_item--hidden' );
						setTimeout( function() {
							$product.removeClass( 'mini_cart_item--hidden' );
						}, 100 )
					}
				});
			}
			$button.text( pixelgradeWooCommerceStrings.added_to_cart );
			$( '.c-mini-cart' ).addClass( 'c-mini-cart--visible' );
		}
function onAddedToCart ( event , fragments , cart_hash , $button ) { var key = 'div.widget_shopping_cart_content' ; var sku = $button . data ( 'product_sku' ) ; if ( key in fragments ) { $body . one ( 'wc_fragments_loaded' , function ( ) { var $fragment = $ ( key ) ; var $productList = $fragment . find ( '.product_list_widget' ) ; var $product = $productList . find ( '[data-product_sku="' + sku + '"]' ) . closest ( '.mini_cart_item' ) ; if ( $product . length ) { if ( document . documentElement . scrollIntoView ) { $product . get ( 0 ) . scrollIntoView ( ) ; } $product . addClass ( 'mini_cart_item--hidden' ) ; setTimeout ( function ( ) { $product . removeClass ( 'mini_cart_item--hidden' ) ; } , 100 ) } } ) ; } $button . text ( pixelgradeWooCommerceStrings . added_to_cart ) ; $ ( '.c-mini-cart' ) . addClass ( 'c-mini-cart--visible' ) ; }
show mini cart when a product is added to cart
show mini cart when a product is added to cart
// scroll the newly added product into view // prepare the fade-in animation for the updated product in the cart // trigger the animation to show the updated product shortly after the cart slides into view