Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xlplugins/33158f8091c7bbf0a5d7272966f4a78c to your computer and use it in GitHub Desktop.
Save xlplugins/33158f8091c7bbf0a5d7272966f4a78c to your computer and use it in GitHub Desktop.
update side cart at page load #side cart
add_action('fkcart_before_cart_items', 'custom_js_snippet');
function custom_js_snippet() {
?>
<script>
jQuery(function($) {
$(window).on('load', function() {
$('body .cart-trigger').click(function() {
$('body').trigger('fkcart_open');
});
setTimeout(function() {
if (typeof jQuery === 'undefined') {
console.log('jQuery not found');
return;
}
console.log("yesyys test")
$('body').trigger('fkcart_update_side_cart', [true]);
}, 300);
});
});
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment