WC_AJAX::remove_from_cart()
AJAX remove from cart.
Method of the class: WC_AJAX{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = WC_AJAX::remove_from_cart();
WC_AJAX::remove_from_cart() WC AJAX::remove from cart code WC 9.2.3
public static function remove_from_cart() { ob_start(); // phpcs:ignore WordPress.Security.NonceVerification.Missing $cart_item_key = wc_clean( isset( $_POST['cart_item_key'] ) ? wp_unslash( $_POST['cart_item_key'] ) : '' ); if ( $cart_item_key && false !== WC()->cart->remove_cart_item( $cart_item_key ) ) { self::get_refreshed_fragments(); } else { wp_send_json_error(); } }