From 24202f585366d8bcb58c5032a1c533fdb9d22fb0 Mon Sep 17 00:00:00 2001 From: Ashley Gibson Date: Fri, 30 Oct 2020 11:46:33 +0000 Subject: [PATCH] Check if download_id exists before using #8181 --- includes/cart/actions.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/cart/actions.php b/includes/cart/actions.php index b2713beaf90..19369495b47 100755 --- a/includes/cart/actions.php +++ b/includes/cart/actions.php @@ -64,7 +64,7 @@ function edd_process_cart_endpoints() { * @param $data */ function edd_process_add_to_cart( $data ) { - $download_id = absint( $data['download_id'] ); + $download_id = ! empty( $data['download_id'] ) ? absint( $data['download_id'] ) : false; $options = isset( $data['edd_options'] ) ? $data['edd_options'] : array(); if ( ! empty( $data['edd_download_quantity'] ) ) { @@ -77,7 +77,9 @@ function edd_process_add_to_cart( $data ) { } } - $cart = edd_add_to_cart( $download_id, $options ); + if ( ! empty( $download_id ) ) { + edd_add_to_cart( $download_id, $options ); + } if ( edd_straight_to_checkout() && ! edd_is_checkout() ) { $query_args = remove_query_arg( array( 'edd_action', 'download_id', 'edd_options' ) );