removed wc_get_product_by_sku

This commit is contained in:
Guillermo Gette 2015-03-18 23:09:38 +11:00
parent b8578c044d
commit 122cca701b
1 changed files with 0 additions and 24 deletions

View File

@ -21,30 +21,6 @@ function wc_get_product( $the_product = false, $args = array() ) {
return WC()->product_factory->get_product( $the_product, $args );
}
/**
* Return a product object by SKU
*
* @param string $sku
* @return WC_Product
*/
function wc_get_product_by_sku( $sku = "" ) {
global $wpdb;
$product_id = $wpdb->get_var( $wpdb->prepare( "
SELECT $wpdb->posts.ID
FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )
WHERE $wpdb->posts.post_type IN ( 'product', 'product_variation' )
AND $wpdb->postmeta.meta_key = '_sku' AND $wpdb->postmeta.meta_value = '%s' LIMIT 1
", $sku ) );
if ($product_id) {
return wc_get_product($product_id);
} else {
return false;
}
}
/**
* Update a product's stock amount
*