Merge pull request #14509 from woocommerce/fix/14480

Only return product by SKU if published
This commit is contained in:
Claudio Sanches 2017-04-19 14:38:14 -03:00 committed by GitHub
commit c90e71e890
1 changed files with 3 additions and 1 deletions

View File

@ -822,7 +822,9 @@ class WC_Product_Data_Store_CPT extends WC_Data_Store_WP implements WC_Object_Da
FROM $wpdb->posts AS posts
LEFT JOIN $wpdb->postmeta AS postmeta ON ( posts.ID = postmeta.post_id )
WHERE posts.post_type IN ( 'product', 'product_variation' )
AND postmeta.meta_key = '_sku' AND postmeta.meta_value = '%s'
AND posts.post_status != 'trash'
AND postmeta.meta_key = '_sku'
AND postmeta.meta_value = '%s'
LIMIT 1
", $sku ) );
}