@@ 268-281 (lines=14) @@ | ||
265 | * |
|
266 | * @since 2.5.0 |
|
267 | */ |
|
268 | public function get( $args, $assoc_args ) { |
|
269 | try { |
|
270 | $order = wc_get_order( $args[0] ); |
|
271 | if ( ! $order ) { |
|
272 | throw new WC_CLI_Exception( 'woocommerce_cli_invalid_order', sprintf( __( 'Invalid order "%s"', 'woocommerce' ), $args[0] ) ); |
|
273 | } |
|
274 | $order_data = $this->get_order_data( $order ); |
|
275 | ||
276 | $formatter = $this->get_formatter( $assoc_args ); |
|
277 | $formatter->display_item( $order_data ); |
|
278 | } catch ( WC_CLI_Exception $e ) { |
|
279 | WP_CLI::error( $e->getMessage() ); |
|
280 | } |
|
281 | } |
|
282 | ||
283 | /** |
|
284 | * List orders. |
@@ 291-304 (lines=14) @@ | ||
288 | * |
|
289 | * @since 2.5.0 |
|
290 | */ |
|
291 | public function get( $args, $assoc_args ) { |
|
292 | try { |
|
293 | $product = wc_get_product( $args[0] ); |
|
294 | if ( ! $product ) { |
|
295 | throw new WC_CLI_Exception( 'woocommerce_cli_invalid_product', sprintf( __( 'Invalid product "%s"', 'woocommerce' ), $args[0] ) ); |
|
296 | } |
|
297 | $product_data = $this->get_product_data( $product ); |
|
298 | ||
299 | $formatter = $this->get_formatter( $assoc_args ); |
|
300 | $formatter->display_item( $product_data ); |
|
301 | } catch ( WC_CLI_Exception $e ) { |
|
302 | WP_CLI::error( $e->getMessage() ); |
|
303 | } |
|
304 | } |
|
305 | ||
306 | /** |
|
307 | * List products. |