is_existing_sku should check all post statuses except for trash
Fixes #14525
This commit is contained in:
parent
8ab10ade0e
commit
bdb01c4bea
|
@ -802,7 +802,7 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
|
||||||
FROM $wpdb->posts
|
FROM $wpdb->posts
|
||||||
LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )
|
LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )
|
||||||
WHERE $wpdb->posts.post_type IN ( 'product', 'product_variation' )
|
WHERE $wpdb->posts.post_type IN ( 'product', 'product_variation' )
|
||||||
AND $wpdb->posts.post_status = 'publish'
|
AND $wpdb->posts.post_status != 'trash'
|
||||||
AND $wpdb->postmeta.meta_key = '_sku' AND $wpdb->postmeta.meta_value = '%s'
|
AND $wpdb->postmeta.meta_key = '_sku' AND $wpdb->postmeta.meta_value = '%s'
|
||||||
AND $wpdb->postmeta.post_id <> %d LIMIT 1
|
AND $wpdb->postmeta.post_id <> %d LIMIT 1
|
||||||
", wp_slash( $sku ), $product_id ) );
|
", wp_slash( $sku ), $product_id ) );
|
||||||
|
|
Loading…
Reference in New Issue