Only allow those who can edit the post to add drafts to cart. For testing. Closes #3381
This commit is contained in:
parent
e6db7d2c0c
commit
a9569ccd6f
|
@ -708,6 +708,10 @@ class WC_Product {
|
|||
elseif ( $this->get_price() === '' )
|
||||
$purchasable = false;
|
||||
|
||||
// Check the product is published
|
||||
elseif ( $this->post->post_status !== 'publish' && ! current_user_can( 'edit_post', $this->id ) )
|
||||
$purchasable = false;
|
||||
|
||||
return apply_filters( 'woocommerce_is_purchasable', $purchasable, $this );
|
||||
}
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ class WC_Cart {
|
|||
// Check item stock
|
||||
$result = $this->check_cart_item_stock();
|
||||
|
||||
if (is_wp_error($result))
|
||||
if ( is_wp_error( $result ) )
|
||||
wc_add_error( $result->get_error_message() );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue