I wanna delete an item from cart via ajax. I'm trying to use the method 'remove_order_item' from the WC_AJAX class: http://docs.woothemes.com/wc-apidocs/source-class-WC_AJAX.html.
I tried following javascript code. The server can successfully be called, but the item won't be deleted. What am I doing wrong?
$.ajax({
url:"/wp-admin/admin-ajax.php",
type: "POST",
data : "action=woocommerce_remove_order_item&order_item_ids=[someId]",
success: function(data, textStatus, jqXHR)
{
alert(textStatus);
alert(data);
},
error: function (jqXHR, textStatus, errorThrown)
{
alert(textStatus);
}
});