Fixed WC_API_Products::clear_product()
This commit is contained in:
parent
157503a6d3
commit
a01660cbba
|
@ -291,7 +291,9 @@ class WC_API_Products extends WC_API_Resource {
|
|||
|
||||
return $this->get_product( $id );
|
||||
} catch ( WC_API_Exception $e ) {
|
||||
// Remove the product when fails
|
||||
$this->clear_product( $id );
|
||||
|
||||
return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) );
|
||||
}
|
||||
}
|
||||
|
@ -2319,8 +2321,8 @@ class WC_API_Products extends WC_API_Resource {
|
|||
*/
|
||||
protected function clear_product( $product_id ) {
|
||||
if ( ! is_numeric( $product_id ) || 0 >= $product_id ) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete product attachments
|
||||
$attachments = get_children( array(
|
||||
|
|
|
@ -2320,7 +2320,7 @@ class WC_API_Products extends WC_API_Resource {
|
|||
* Clear product
|
||||
*/
|
||||
protected function clear_product( $product_id ) {
|
||||
if ( 0 >= $product_id ) {
|
||||
if ( ! is_numeric( $product_id ) || 0 >= $product_id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue