Use WC_Data_Exception in WC_Product_Variation_Data_Store_CPT
This commit is contained in:
parent
85a077b939
commit
3ebda4a431
|
@ -37,7 +37,7 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
|
|||
*
|
||||
* @since 3.0.0
|
||||
* @param WC_Product_Variation $product Product object.
|
||||
* @throws WC_Data_Exception If WC_Product::set_tax_status() is called with an invalid tax status (via read_product_data).
|
||||
* @throws WC_Data_Exception If WC_Product::set_tax_status() is called with an invalid tax status (via read_product_data), or when passing an invalid ID.
|
||||
*/
|
||||
public function read( &$product ) {
|
||||
$product->set_defaults();
|
||||
|
@ -53,7 +53,7 @@ class WC_Product_Variation_Data_Store_CPT extends WC_Product_Data_Store_CPT impl
|
|||
}
|
||||
|
||||
if ( 'product_variation' !== $post_object->post_type ) {
|
||||
throw new Exception( 'Invalid product type: passed ID does not correspond to a product variation.' );
|
||||
throw new WC_Data_Exception( 'variation_invalid_id', __( 'Invalid product type: passed ID does not correspond to a product variation.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
$product->set_props(
|
||||
|
|
Loading…
Reference in New Issue