Skip to content

Commit

Permalink
Merge pull request #8182 from easydigitaldownloads/issue/8181
Browse files Browse the repository at this point in the history
Check if download_id exists before using #8181
  • Loading branch information
ashleyfae committed Nov 2, 2020
2 parents e8b40e5 + 24202f5 commit 0733860
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions includes/cart/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ) ) {
Expand All @@ -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' ) );
Expand Down

0 comments on commit 0733860

Please sign in to comment.