If the plugin removes the item button that is not working you can try this code…
Add this in your footer.php
//Woofc remove button
$(".woofc-item-remove").click(function(){
var datakey=$(this).closest(".woofc-item-has-remove").data('key');
// ajax call for remove item button through data_key
$.ajax({
type : "post",
url: '<?php echo admin_url( 'admin-ajax.php' ); ?>',
data:{
'action' : 'remove_item_minicart',
'dta_key' : datakey,
},
success: function(data)
{
$('.woofc-inner').removeClass('woofc-inner-loading');
$('.woofc-item-has-remove[data-key="' +datakey+ '"]').remove();
console.log('removed successfully');
}
});
});
and add this to your functions.php
function remove_item_from_minicart()
{
WC()->cart->remove_cart_item( $_POST['dta_key'] );
die(0);
}
add_action("wp_ajax_remove_item_minicart", "remove_item_from_minicart");
add_action("wp_ajax_nopriv_remove_item_minicart", "remove_item_from_minicart");
-
This reply was modified 2 years, 3 months ago by
Farhat Ullah.
-
This reply was modified 2 years, 3 months ago by
Farhat Ullah.
-
This reply was modified 2 years, 3 months ago by
Farhat Ullah.