Ensure product exists in add cart handler

Closes #8937
This commit is contained in:
Mike Jolley 2015-08-24 15:28:57 +01:00
parent f03be47e86
commit a07824e8a7
1 changed files with 5 additions and 0 deletions

View File

@ -580,6 +580,11 @@ class WC_Form_Handler {
$product_id = apply_filters( 'woocommerce_add_to_cart_product_id', absint( $_REQUEST['add-to-cart'] ) );
$was_added_to_cart = false;
$adding_to_cart = wc_get_product( $product_id );
if ( ! $adding_to_cart ) {
return;
}
$add_to_cart_handler = apply_filters( 'woocommerce_add_to_cart_handler', $adding_to_cart->product_type, $adding_to_cart );
// Variable product handling