Prevent external product in cart

This commit is contained in:
Mike Jolley 2011-11-09 12:17:05 +00:00
parent 555b015b9c
commit 24fc037f86
1 changed files with 7 additions and 1 deletions

View File

@ -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;