Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if download_id exists before using #8181 #8182

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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