| 1 |
"use strict"; |
| 2 |
|
| 3 |
/** |
| 4 |
* Merchant side cart |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
jQuery(document).ready(function ($) { |
| 9 |
if (merchant.setting.hasOwnProperty('show_after_add_to_cart_single_product')) { |
| 10 |
if ($('body.single-product') && $('.woocommerce-notices-wrapper').is(':visible')) { |
| 11 |
$('body').toggleClass('merchant-floating-side-mini-cart-show'); |
| 12 |
$(window).trigger('merchant.floating-mini-cart-resize'); |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
// Add to cart AJAX event. |
| 17 |
if (merchant.setting.hasOwnProperty('add_to_cart_slide_out')) { |
| 18 |
$(document.body).on('added_to_cart', function (event, fragments, cart_hash, $button) { |
| 19 |
$('body').toggleClass('merchant-floating-side-mini-cart-show'); |
| 20 |
$(window).trigger('merchant.floating-mini-cart-resize'); |
| 21 |
}); |
| 22 |
} |
| 23 |
|
| 24 |
// On cart URL click |
| 25 |
if (merchant.setting.hasOwnProperty('cart_url')) { |
| 26 |
$('[href="' + merchant.setting.cart_url + '"]').on('click', function (e) { |
| 27 |
e.preventDefault(); |
| 28 |
$(window).trigger('merchant.floating-mini-cart-resize'); |
| 29 |
$('body').toggleClass('merchant-floating-side-mini-cart-show'); |
| 30 |
}); |
| 31 |
} |
| 32 |
}); |