From 1fc2a7a444745bc96da2fdb9d81d24a25aebe90e Mon Sep 17 00:00:00 2001 From: "j.ostrowka" Date: Thu, 21 Nov 2024 12:27:16 +0100 Subject: [PATCH] pb-1295 --- includes/cart/functions.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/cart/functions.php b/includes/cart/functions.php index 56bb5c8dc4..662d80c6e8 100644 --- a/includes/cart/functions.php +++ b/includes/cart/functions.php @@ -135,7 +135,11 @@ function edd_get_cart_quantity() { function edd_add_to_cart( $download_id, $options = array() ) { $download = get_post( $download_id ); - if( 'download' != ($download->post_type ?? null) ) + if (!$download) { + return; + } + + if( 'download' != $download->post_type ) return; // Not a download product if ( ! current_user_can( 'edit_post', $download->ID ) && $download->post_status != 'publish' ) {