• Resolved Farhat Ullah

    (@farhat7776240)


    Hi
    1) When I click on remove button of the item it not removing the item
    2) when I click on plus or minus it goes to the loading.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter Farhat Ullah

    (@farhat7776240)

    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.
Viewing 1 replies (of 1 total)
  • The topic ‘Item Remove button not working’ is closed to new replies.