Last active
April 23, 2019 05:50
-
-
Save AshlinRejo/72ac334f3ff34897a6747cb57f9fd857 to your computer and use it in GitHub Desktop.
Woo Discount: Woo side cart compatible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Before adding this do the following | |
* | |
* 1. Create a template override for the file | |
* [PLUGIN_PATH]/woocommerce-side-cart-premium/public/partials/xoo-wsc-content.php | |
* by copying the file to [ACTIVE_THEME_FOLDER_PATH]/woocommerce/xoo-wsc-content.php | |
* | |
* 2. add the code snippet in line number 10 | |
* | |
* do_action( 'woocommerce_before_mini_cart' ); | |
* | |
**/ | |
add_action('wp_footer', function(){ | |
?> | |
<script type="text/javascript"> | |
jQuery( document ).ready(function() { | |
jQuery(document.body).on('xoo_wsc_cart_updated added_to_cart',function() { | |
jQuery( document.body ).trigger( 'wc_fragment_refresh' ); | |
}); | |
}); | |
</script> | |
<?php | |
}, 11); | |
add_action('woocommerce_before_mini_cart', function(){ | |
if (!WC()->cart->is_empty()){ | |
WC()->cart->calculate_totals(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment