Prevent external product in cart
This commit is contained in:
parent
555b015b9c
commit
24fc037f86
|
@ -188,9 +188,15 @@ class woocommerce_cart {
|
|||
$product_data = &new woocommerce_product( $product_id );
|
||||
endif;
|
||||
|
||||
// Type check
|
||||
if ( $product_data->is_type('external') ) :
|
||||
$woocommerce->add_error( __('This product cannot be purchased.', 'woothemes') );
|
||||
return false;
|
||||
endif;
|
||||
|
||||
// Price set check
|
||||
if( $product_data->get_price() === '' ) :
|
||||
$woocommerce->add_error( __('This product cannot be purchased - the price is not yet set', 'woothemes') );
|
||||
$woocommerce->add_error( __('This product cannot be purchased - the price is not yet set.', 'woothemes') );
|
||||
return false;
|
||||
endif;
|
||||
|
||||
|
|
Loading…
Reference in New Issue