| @@ 917-925 (lines=9) @@ | ||
| 914 | } |
|
| 915 | ||
| 916 | // when updating, ensure product ID provided matches |
|
| 917 | if ( 'update' === $action ) { |
|
| 918 | ||
| 919 | $item_product_id = wc_get_order_item_meta( $item['id'], '_product_id' ); |
|
| 920 | $item_variation_id = wc_get_order_item_meta( $item['id'], '_variation_id' ); |
|
| 921 | ||
| 922 | if ( $item['product_id'] != $item_product_id && $item['product_id'] != $item_variation_id ) { |
|
| 923 | throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product_id', __( 'Product ID provided does not match this line item', 'woocommerce' ) ); |
|
| 924 | } |
|
| 925 | } |
|
| 926 | ||
| 927 | if ( isset( $item['product_id'] ) ) { |
|
| 928 | $product_id = $item['product_id']; |
|
| @@ 912-920 (lines=9) @@ | ||
| 909 | } |
|
| 910 | ||
| 911 | // when updating, ensure product ID provided matches |
|
| 912 | if ( 'update' === $action ) { |
|
| 913 | ||
| 914 | $item_product_id = wc_get_order_item_meta( $item['id'], '_product_id' ); |
|
| 915 | $item_variation_id = wc_get_order_item_meta( $item['id'], '_variation_id' ); |
|
| 916 | ||
| 917 | if ( $item['product_id'] != $item_product_id && $item['product_id'] != $item_variation_id ) { |
|
| 918 | throw new WC_API_Exception( 'woocommerce_api_invalid_product_id', __( 'Product ID provided does not match this line item', 'woocommerce' ), 400 ); |
|
| 919 | } |
|
| 920 | } |
|
| 921 | ||
| 922 | if ( isset( $item['product_id'] ) ) { |
|
| 923 | $product_id = $item['product_id']; |
|