You appear to be a bot. Output may be restricted
Description
Removes item from cart via AJAX.
Usage
$void = edd_ajax_remove_from_cart();
Parameters
Returns
void
Source
File name: easy-digital-downloads/includes/ajax-functions.php
Lines:
1 to 38 of 38
function edd_ajax_remove_from_cart() { if ( ! isset( $_POST['nonce'] ) ) { edd_debug_log( __( 'Missing nonce when removing an item from the cart. Please read the following for more information: https://easydigitaldownloads.com/development/2018/07/05/important-update-to-ajax-requests-in-easy-digital-downloads-2-9-4', 'easy-digital-downloads' ), true ); } if ( isset( $_POST['cart_item'] ) && isset( $_POST['nonce'] ) ) { $cart_item = absint( $_POST['cart_item'] ); $nonce = sanitize_text_field( $_POST['nonce'] ); $nonce_verified = wp_verify_nonce( $nonce, 'edd-remove-cart-widget-item' ); if ( false === $nonce_verified ) { $return = array( 'removed' => 0 ); } else { edd_remove_from_cart( $cart_item ); $return = array( 'removed' => 1, 'subtotal' => html_entity_decode( edd_currency_filter( edd_format_amount( edd_get_cart_subtotal() ) ), ENT_COMPAT, 'UTF-8' ), 'total' => html_entity_decode( edd_currency_filter( edd_format_amount( edd_get_cart_total() ) ), ENT_COMPAT, 'UTF-8' ), 'cart_quantity' => html_entity_decode( edd_get_cart_quantity() ), ); if ( edd_use_taxes() ) { $cart_tax = (float) edd_get_cart_tax(); $return['tax'] = html_entity_decode( edd_currency_filter( edd_format_amount( $cart_tax ) ), ENT_COMPAT, 'UTF-8' ); } } $return = apply_filters( 'edd_ajax_remove_from_cart_response', $return ); echo json_encode( $return ); } edd_die(); }