Conditions | 1 |
Paths | 1 |
Total Lines | 838 |
Code Lines | 666 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
299 | public function get_item_schema() { |
||
300 | $schema = array( |
||
301 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
||
302 | 'title' => $this->post_type, |
||
303 | 'type' => 'object', |
||
304 | 'properties' => array( |
||
305 | 'id' => array( |
||
306 | 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ), |
||
307 | 'type' => 'integer', |
||
308 | 'context' => array( 'view', 'edit' ), |
||
309 | 'readonly' => true, |
||
310 | ), |
||
311 | 'parent_id' => array( |
||
312 | 'description' => __( 'Parent order ID.', 'woocommerce' ), |
||
313 | 'type' => 'integer', |
||
314 | 'context' => array( 'view', 'edit' ), |
||
315 | ), |
||
316 | 'number' => array( |
||
317 | 'description' => __( 'Order number.', 'woocommerce' ), |
||
318 | 'type' => 'string', |
||
319 | 'context' => array( 'view', 'edit' ), |
||
320 | 'readonly' => true, |
||
321 | ), |
||
322 | 'order_key' => array( |
||
323 | 'description' => __( 'Order key.', 'woocommerce' ), |
||
324 | 'type' => 'string', |
||
325 | 'context' => array( 'view', 'edit' ), |
||
326 | 'readonly' => true, |
||
327 | ), |
||
328 | 'created_via' => array( |
||
329 | 'description' => __( 'Shows where the order was created.', 'woocommerce' ), |
||
330 | 'type' => 'string', |
||
331 | 'context' => array( 'view', 'edit' ), |
||
332 | 'readonly' => true, |
||
333 | ), |
||
334 | 'version' => array( |
||
335 | 'description' => __( 'Version of WooCommerce which last updated the order.', 'woocommerce' ), |
||
336 | 'type' => 'integer', |
||
337 | 'context' => array( 'view', 'edit' ), |
||
338 | 'readonly' => true, |
||
339 | ), |
||
340 | 'status' => array( |
||
341 | 'description' => __( 'Order status.', 'woocommerce' ), |
||
342 | 'type' => 'string', |
||
343 | 'default' => 'pending', |
||
344 | 'enum' => $this->get_order_statuses(), |
||
345 | 'context' => array( 'view', 'edit' ), |
||
346 | ), |
||
347 | 'currency' => array( |
||
348 | 'description' => __( 'Currency the order was created with, in ISO format.', 'woocommerce' ), |
||
349 | 'type' => 'string', |
||
350 | 'default' => get_woocommerce_currency(), |
||
351 | 'enum' => array_keys( get_woocommerce_currencies() ), |
||
352 | 'context' => array( 'view', 'edit' ), |
||
353 | ), |
||
354 | 'currency_symbol' => array( |
||
355 | 'description' => __( 'Currency symbol.', 'woocommerce' ), |
||
356 | 'type' => 'string', |
||
357 | 'context' => array( 'view', 'edit' ), |
||
358 | 'readonly' => true, |
||
359 | ), |
||
360 | 'date_created' => array( |
||
361 | 'description' => __( "The date the order was created, in the site's timezone.", 'woocommerce' ), |
||
362 | 'type' => 'date-time', |
||
363 | 'context' => array( 'view', 'edit' ), |
||
364 | 'readonly' => true, |
||
365 | ), |
||
366 | 'date_created_gmt' => array( |
||
367 | 'description' => __( 'The date the order was created, as GMT.', 'woocommerce' ), |
||
368 | 'type' => 'date-time', |
||
369 | 'context' => array( 'view', 'edit' ), |
||
370 | 'readonly' => true, |
||
371 | ), |
||
372 | 'date_modified' => array( |
||
373 | 'description' => __( "The date the order was last modified, in the site's timezone.", 'woocommerce' ), |
||
374 | 'type' => 'date-time', |
||
375 | 'context' => array( 'view', 'edit' ), |
||
376 | 'readonly' => true, |
||
377 | ), |
||
378 | 'date_modified_gmt' => array( |
||
379 | 'description' => __( 'The date the order was last modified, as GMT.', 'woocommerce' ), |
||
380 | 'type' => 'date-time', |
||
381 | 'context' => array( 'view', 'edit' ), |
||
382 | 'readonly' => true, |
||
383 | ), |
||
384 | 'discount_total' => array( |
||
385 | 'description' => __( 'Total discount amount for the order.', 'woocommerce' ), |
||
386 | 'type' => 'string', |
||
387 | 'context' => array( 'view', 'edit' ), |
||
388 | 'readonly' => true, |
||
389 | ), |
||
390 | 'discount_tax' => array( |
||
391 | 'description' => __( 'Total discount tax amount for the order.', 'woocommerce' ), |
||
392 | 'type' => 'string', |
||
393 | 'context' => array( 'view', 'edit' ), |
||
394 | 'readonly' => true, |
||
395 | ), |
||
396 | 'shipping_total' => array( |
||
397 | 'description' => __( 'Total shipping amount for the order.', 'woocommerce' ), |
||
398 | 'type' => 'string', |
||
399 | 'context' => array( 'view', 'edit' ), |
||
400 | 'readonly' => true, |
||
401 | ), |
||
402 | 'shipping_tax' => array( |
||
403 | 'description' => __( 'Total shipping tax amount for the order.', 'woocommerce' ), |
||
404 | 'type' => 'string', |
||
405 | 'context' => array( 'view', 'edit' ), |
||
406 | 'readonly' => true, |
||
407 | ), |
||
408 | 'cart_tax' => array( |
||
409 | 'description' => __( 'Sum of line item taxes only.', 'woocommerce' ), |
||
410 | 'type' => 'string', |
||
411 | 'context' => array( 'view', 'edit' ), |
||
412 | 'readonly' => true, |
||
413 | ), |
||
414 | 'total' => array( |
||
415 | 'description' => __( 'Grand total.', 'woocommerce' ), |
||
416 | 'type' => 'string', |
||
417 | 'context' => array( 'view', 'edit' ), |
||
418 | 'readonly' => true, |
||
419 | ), |
||
420 | 'total_tax' => array( |
||
421 | 'description' => __( 'Sum of all taxes.', 'woocommerce' ), |
||
422 | 'type' => 'string', |
||
423 | 'context' => array( 'view', 'edit' ), |
||
424 | 'readonly' => true, |
||
425 | ), |
||
426 | 'prices_include_tax' => array( |
||
427 | 'description' => __( 'True the prices included tax during checkout.', 'woocommerce' ), |
||
428 | 'type' => 'boolean', |
||
429 | 'context' => array( 'view', 'edit' ), |
||
430 | 'readonly' => true, |
||
431 | ), |
||
432 | 'customer_id' => array( |
||
433 | 'description' => __( 'User ID who owns the order. 0 for guests.', 'woocommerce' ), |
||
434 | 'type' => 'integer', |
||
435 | 'default' => 0, |
||
436 | 'context' => array( 'view', 'edit' ), |
||
437 | ), |
||
438 | 'customer_ip_address' => array( |
||
439 | 'description' => __( "Customer's IP address.", 'woocommerce' ), |
||
440 | 'type' => 'string', |
||
441 | 'context' => array( 'view', 'edit' ), |
||
442 | 'readonly' => true, |
||
443 | ), |
||
444 | 'customer_user_agent' => array( |
||
445 | 'description' => __( 'User agent of the customer.', 'woocommerce' ), |
||
446 | 'type' => 'string', |
||
447 | 'context' => array( 'view', 'edit' ), |
||
448 | 'readonly' => true, |
||
449 | ), |
||
450 | 'customer_note' => array( |
||
451 | 'description' => __( 'Note left by customer during checkout.', 'woocommerce' ), |
||
452 | 'type' => 'string', |
||
453 | 'context' => array( 'view', 'edit' ), |
||
454 | ), |
||
455 | 'billing' => array( |
||
456 | 'description' => __( 'Billing address.', 'woocommerce' ), |
||
457 | 'type' => 'object', |
||
458 | 'context' => array( 'view', 'edit' ), |
||
459 | 'properties' => array( |
||
460 | 'first_name' => array( |
||
461 | 'description' => __( 'First name.', 'woocommerce' ), |
||
462 | 'type' => 'string', |
||
463 | 'context' => array( 'view', 'edit' ), |
||
464 | ), |
||
465 | 'last_name' => array( |
||
466 | 'description' => __( 'Last name.', 'woocommerce' ), |
||
467 | 'type' => 'string', |
||
468 | 'context' => array( 'view', 'edit' ), |
||
469 | ), |
||
470 | 'company' => array( |
||
471 | 'description' => __( 'Company name.', 'woocommerce' ), |
||
472 | 'type' => 'string', |
||
473 | 'context' => array( 'view', 'edit' ), |
||
474 | ), |
||
475 | 'address_1' => array( |
||
476 | 'description' => __( 'Address line 1', 'woocommerce' ), |
||
477 | 'type' => 'string', |
||
478 | 'context' => array( 'view', 'edit' ), |
||
479 | ), |
||
480 | 'address_2' => array( |
||
481 | 'description' => __( 'Address line 2', 'woocommerce' ), |
||
482 | 'type' => 'string', |
||
483 | 'context' => array( 'view', 'edit' ), |
||
484 | ), |
||
485 | 'city' => array( |
||
486 | 'description' => __( 'City name.', 'woocommerce' ), |
||
487 | 'type' => 'string', |
||
488 | 'context' => array( 'view', 'edit' ), |
||
489 | ), |
||
490 | 'state' => array( |
||
491 | 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), |
||
492 | 'type' => 'string', |
||
493 | 'context' => array( 'view', 'edit' ), |
||
494 | ), |
||
495 | 'postcode' => array( |
||
496 | 'description' => __( 'Postal code.', 'woocommerce' ), |
||
497 | 'type' => 'string', |
||
498 | 'context' => array( 'view', 'edit' ), |
||
499 | ), |
||
500 | 'country' => array( |
||
501 | 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ), |
||
502 | 'type' => 'string', |
||
503 | 'context' => array( 'view', 'edit' ), |
||
504 | ), |
||
505 | 'email' => array( |
||
506 | 'description' => __( 'Email address.', 'woocommerce' ), |
||
507 | 'type' => 'string', |
||
508 | 'format' => 'email', |
||
509 | 'context' => array( 'view', 'edit' ), |
||
510 | ), |
||
511 | 'phone' => array( |
||
512 | 'description' => __( 'Phone number.', 'woocommerce' ), |
||
513 | 'type' => 'string', |
||
514 | 'context' => array( 'view', 'edit' ), |
||
515 | ), |
||
516 | ), |
||
517 | ), |
||
518 | 'shipping' => array( |
||
519 | 'description' => __( 'Shipping address.', 'woocommerce' ), |
||
520 | 'type' => 'object', |
||
521 | 'context' => array( 'view', 'edit' ), |
||
522 | 'properties' => array( |
||
523 | 'first_name' => array( |
||
524 | 'description' => __( 'First name.', 'woocommerce' ), |
||
525 | 'type' => 'string', |
||
526 | 'context' => array( 'view', 'edit' ), |
||
527 | ), |
||
528 | 'last_name' => array( |
||
529 | 'description' => __( 'Last name.', 'woocommerce' ), |
||
530 | 'type' => 'string', |
||
531 | 'context' => array( 'view', 'edit' ), |
||
532 | ), |
||
533 | 'company' => array( |
||
534 | 'description' => __( 'Company name.', 'woocommerce' ), |
||
535 | 'type' => 'string', |
||
536 | 'context' => array( 'view', 'edit' ), |
||
537 | ), |
||
538 | 'address_1' => array( |
||
539 | 'description' => __( 'Address line 1', 'woocommerce' ), |
||
540 | 'type' => 'string', |
||
541 | 'context' => array( 'view', 'edit' ), |
||
542 | ), |
||
543 | 'address_2' => array( |
||
544 | 'description' => __( 'Address line 2', 'woocommerce' ), |
||
545 | 'type' => 'string', |
||
546 | 'context' => array( 'view', 'edit' ), |
||
547 | ), |
||
548 | 'city' => array( |
||
549 | 'description' => __( 'City name.', 'woocommerce' ), |
||
550 | 'type' => 'string', |
||
551 | 'context' => array( 'view', 'edit' ), |
||
552 | ), |
||
553 | 'state' => array( |
||
554 | 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ), |
||
555 | 'type' => 'string', |
||
556 | 'context' => array( 'view', 'edit' ), |
||
557 | ), |
||
558 | 'postcode' => array( |
||
559 | 'description' => __( 'Postal code.', 'woocommerce' ), |
||
560 | 'type' => 'string', |
||
561 | 'context' => array( 'view', 'edit' ), |
||
562 | ), |
||
563 | 'country' => array( |
||
564 | 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ), |
||
565 | 'type' => 'string', |
||
566 | 'context' => array( 'view', 'edit' ), |
||
567 | ), |
||
568 | ), |
||
569 | ), |
||
570 | 'payment_method' => array( |
||
571 | 'description' => __( 'Payment method ID.', 'woocommerce' ), |
||
572 | 'type' => 'string', |
||
573 | 'context' => array( 'view', 'edit' ), |
||
574 | ), |
||
575 | 'payment_method_title' => array( |
||
576 | 'description' => __( 'Payment method title.', 'woocommerce' ), |
||
577 | 'type' => 'string', |
||
578 | 'context' => array( 'view', 'edit' ), |
||
579 | 'arg_options' => array( |
||
580 | 'sanitize_callback' => 'sanitize_text_field', |
||
581 | ), |
||
582 | ), |
||
583 | 'transaction_id' => array( |
||
584 | 'description' => __( 'Unique transaction ID.', 'woocommerce' ), |
||
585 | 'type' => 'string', |
||
586 | 'context' => array( 'view', 'edit' ), |
||
587 | ), |
||
588 | 'date_paid' => array( |
||
589 | 'description' => __( "The date the order was paid, in the site's timezone.", 'woocommerce' ), |
||
590 | 'type' => 'date-time', |
||
591 | 'context' => array( 'view', 'edit' ), |
||
592 | 'readonly' => true, |
||
593 | ), |
||
594 | 'date_paid_gmt' => array( |
||
595 | 'description' => __( 'The date the order was paid, as GMT.', 'woocommerce' ), |
||
596 | 'type' => 'date-time', |
||
597 | 'context' => array( 'view', 'edit' ), |
||
598 | 'readonly' => true, |
||
599 | ), |
||
600 | 'date_completed' => array( |
||
601 | 'description' => __( "The date the order was completed, in the site's timezone.", 'woocommerce' ), |
||
602 | 'type' => 'date-time', |
||
603 | 'context' => array( 'view', 'edit' ), |
||
604 | 'readonly' => true, |
||
605 | ), |
||
606 | 'date_completed_gmt' => array( |
||
607 | 'description' => __( 'The date the order was completed, as GMT.', 'woocommerce' ), |
||
608 | 'type' => 'date-time', |
||
609 | 'context' => array( 'view', 'edit' ), |
||
610 | 'readonly' => true, |
||
611 | ), |
||
612 | 'cart_hash' => array( |
||
613 | 'description' => __( 'MD5 hash of cart items to ensure orders are not modified.', 'woocommerce' ), |
||
614 | 'type' => 'string', |
||
615 | 'context' => array( 'view', 'edit' ), |
||
616 | 'readonly' => true, |
||
617 | ), |
||
618 | 'meta_data' => array( |
||
619 | 'description' => __( 'Meta data.', 'woocommerce' ), |
||
620 | 'type' => 'array', |
||
621 | 'context' => array( 'view', 'edit' ), |
||
622 | 'items' => array( |
||
623 | 'type' => 'object', |
||
624 | 'properties' => array( |
||
625 | 'id' => array( |
||
626 | 'description' => __( 'Meta ID.', 'woocommerce' ), |
||
627 | 'type' => 'integer', |
||
628 | 'context' => array( 'view', 'edit' ), |
||
629 | 'readonly' => true, |
||
630 | ), |
||
631 | 'key' => array( |
||
632 | 'description' => __( 'Meta key.', 'woocommerce' ), |
||
633 | 'type' => 'string', |
||
634 | 'context' => array( 'view', 'edit' ), |
||
635 | ), |
||
636 | 'value' => array( |
||
637 | 'description' => __( 'Meta value.', 'woocommerce' ), |
||
638 | 'type' => 'mixed', |
||
639 | 'context' => array( 'view', 'edit' ), |
||
640 | ), |
||
641 | ), |
||
642 | ), |
||
643 | ), |
||
644 | 'line_items' => array( |
||
645 | 'description' => __( 'Line items data.', 'woocommerce' ), |
||
646 | 'type' => 'array', |
||
647 | 'context' => array( 'view', 'edit' ), |
||
648 | 'items' => array( |
||
649 | 'type' => 'object', |
||
650 | 'properties' => array( |
||
651 | 'id' => array( |
||
652 | 'description' => __( 'Item ID.', 'woocommerce' ), |
||
653 | 'type' => 'integer', |
||
654 | 'context' => array( 'view', 'edit' ), |
||
655 | 'readonly' => true, |
||
656 | ), |
||
657 | 'name' => array( |
||
658 | 'description' => __( 'Product name.', 'woocommerce' ), |
||
659 | 'type' => 'mixed', |
||
660 | 'context' => array( 'view', 'edit' ), |
||
661 | ), |
||
662 | 'product_id' => array( |
||
663 | 'description' => __( 'Product ID.', 'woocommerce' ), |
||
664 | 'type' => 'mixed', |
||
665 | 'context' => array( 'view', 'edit' ), |
||
666 | ), |
||
667 | 'variation_id' => array( |
||
668 | 'description' => __( 'Variation ID, if applicable.', 'woocommerce' ), |
||
669 | 'type' => 'integer', |
||
670 | 'context' => array( 'view', 'edit' ), |
||
671 | ), |
||
672 | 'quantity' => array( |
||
673 | 'description' => __( 'Quantity ordered.', 'woocommerce' ), |
||
674 | 'type' => 'integer', |
||
675 | 'context' => array( 'view', 'edit' ), |
||
676 | ), |
||
677 | 'tax_class' => array( |
||
678 | 'description' => __( 'Tax class of product.', 'woocommerce' ), |
||
679 | 'type' => 'string', |
||
680 | 'context' => array( 'view', 'edit' ), |
||
681 | ), |
||
682 | 'subtotal' => array( |
||
683 | 'description' => __( 'Line subtotal (before discounts).', 'woocommerce' ), |
||
684 | 'type' => 'string', |
||
685 | 'context' => array( 'view', 'edit' ), |
||
686 | ), |
||
687 | 'subtotal_tax' => array( |
||
688 | 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce' ), |
||
689 | 'type' => 'string', |
||
690 | 'context' => array( 'view', 'edit' ), |
||
691 | 'readonly' => true, |
||
692 | ), |
||
693 | 'total' => array( |
||
694 | 'description' => __( 'Line total (after discounts).', 'woocommerce' ), |
||
695 | 'type' => 'string', |
||
696 | 'context' => array( 'view', 'edit' ), |
||
697 | ), |
||
698 | 'total_tax' => array( |
||
699 | 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), |
||
700 | 'type' => 'string', |
||
701 | 'context' => array( 'view', 'edit' ), |
||
702 | 'readonly' => true, |
||
703 | ), |
||
704 | 'taxes' => array( |
||
705 | 'description' => __( 'Line taxes.', 'woocommerce' ), |
||
706 | 'type' => 'array', |
||
707 | 'context' => array( 'view', 'edit' ), |
||
708 | 'readonly' => true, |
||
709 | 'items' => array( |
||
710 | 'type' => 'object', |
||
711 | 'properties' => array( |
||
712 | 'id' => array( |
||
713 | 'description' => __( 'Tax rate ID.', 'woocommerce' ), |
||
714 | 'type' => 'integer', |
||
715 | 'context' => array( 'view', 'edit' ), |
||
716 | ), |
||
717 | 'total' => array( |
||
718 | 'description' => __( 'Tax total.', 'woocommerce' ), |
||
719 | 'type' => 'string', |
||
720 | 'context' => array( 'view', 'edit' ), |
||
721 | ), |
||
722 | 'subtotal' => array( |
||
723 | 'description' => __( 'Tax subtotal.', 'woocommerce' ), |
||
724 | 'type' => 'string', |
||
725 | 'context' => array( 'view', 'edit' ), |
||
726 | ), |
||
727 | ), |
||
728 | ), |
||
729 | ), |
||
730 | 'meta_data' => array( |
||
731 | 'description' => __( 'Meta data.', 'woocommerce' ), |
||
732 | 'type' => 'array', |
||
733 | 'context' => array( 'view', 'edit' ), |
||
734 | 'items' => array( |
||
735 | 'type' => 'object', |
||
736 | 'properties' => array( |
||
737 | 'id' => array( |
||
738 | 'description' => __( 'Meta ID.', 'woocommerce' ), |
||
739 | 'type' => 'integer', |
||
740 | 'context' => array( 'view', 'edit' ), |
||
741 | 'readonly' => true, |
||
742 | ), |
||
743 | 'key' => array( |
||
744 | 'description' => __( 'Meta key.', 'woocommerce' ), |
||
745 | 'type' => 'string', |
||
746 | 'context' => array( 'view', 'edit' ), |
||
747 | ), |
||
748 | 'value' => array( |
||
749 | 'description' => __( 'Meta value.', 'woocommerce' ), |
||
750 | 'type' => 'mixed', |
||
751 | 'context' => array( 'view', 'edit' ), |
||
752 | ), |
||
753 | ), |
||
754 | ), |
||
755 | ), |
||
756 | 'sku' => array( |
||
757 | 'description' => __( 'Product SKU.', 'woocommerce' ), |
||
758 | 'type' => 'string', |
||
759 | 'context' => array( 'view', 'edit' ), |
||
760 | 'readonly' => true, |
||
761 | ), |
||
762 | 'price' => array( |
||
763 | 'description' => __( 'Product price.', 'woocommerce' ), |
||
764 | 'type' => 'number', |
||
765 | 'context' => array( 'view', 'edit' ), |
||
766 | 'readonly' => true, |
||
767 | ), |
||
768 | ), |
||
769 | ), |
||
770 | ), |
||
771 | 'tax_lines' => array( |
||
772 | 'description' => __( 'Tax lines data.', 'woocommerce' ), |
||
773 | 'type' => 'array', |
||
774 | 'context' => array( 'view', 'edit' ), |
||
775 | 'readonly' => true, |
||
776 | 'items' => array( |
||
777 | 'type' => 'object', |
||
778 | 'properties' => array( |
||
779 | 'id' => array( |
||
780 | 'description' => __( 'Item ID.', 'woocommerce' ), |
||
781 | 'type' => 'integer', |
||
782 | 'context' => array( 'view', 'edit' ), |
||
783 | 'readonly' => true, |
||
784 | ), |
||
785 | 'rate_code' => array( |
||
786 | 'description' => __( 'Tax rate code.', 'woocommerce' ), |
||
787 | 'type' => 'string', |
||
788 | 'context' => array( 'view', 'edit' ), |
||
789 | 'readonly' => true, |
||
790 | ), |
||
791 | 'rate_id' => array( |
||
792 | 'description' => __( 'Tax rate ID.', 'woocommerce' ), |
||
793 | 'type' => 'string', |
||
794 | 'context' => array( 'view', 'edit' ), |
||
795 | 'readonly' => true, |
||
796 | ), |
||
797 | 'label' => array( |
||
798 | 'description' => __( 'Tax rate label.', 'woocommerce' ), |
||
799 | 'type' => 'string', |
||
800 | 'context' => array( 'view', 'edit' ), |
||
801 | 'readonly' => true, |
||
802 | ), |
||
803 | 'compound' => array( |
||
804 | 'description' => __( 'Show if is a compound tax rate.', 'woocommerce' ), |
||
805 | 'type' => 'boolean', |
||
806 | 'context' => array( 'view', 'edit' ), |
||
807 | 'readonly' => true, |
||
808 | ), |
||
809 | 'tax_total' => array( |
||
810 | 'description' => __( 'Tax total (not including shipping taxes).', 'woocommerce' ), |
||
811 | 'type' => 'string', |
||
812 | 'context' => array( 'view', 'edit' ), |
||
813 | 'readonly' => true, |
||
814 | ), |
||
815 | 'shipping_tax_total' => array( |
||
816 | 'description' => __( 'Shipping tax total.', 'woocommerce' ), |
||
817 | 'type' => 'string', |
||
818 | 'context' => array( 'view', 'edit' ), |
||
819 | 'readonly' => true, |
||
820 | ), |
||
821 | 'meta_data' => array( |
||
822 | 'description' => __( 'Meta data.', 'woocommerce' ), |
||
823 | 'type' => 'array', |
||
824 | 'context' => array( 'view', 'edit' ), |
||
825 | 'items' => array( |
||
826 | 'type' => 'object', |
||
827 | 'properties' => array( |
||
828 | 'id' => array( |
||
829 | 'description' => __( 'Meta ID.', 'woocommerce' ), |
||
830 | 'type' => 'integer', |
||
831 | 'context' => array( 'view', 'edit' ), |
||
832 | 'readonly' => true, |
||
833 | ), |
||
834 | 'key' => array( |
||
835 | 'description' => __( 'Meta key.', 'woocommerce' ), |
||
836 | 'type' => 'string', |
||
837 | 'context' => array( 'view', 'edit' ), |
||
838 | ), |
||
839 | 'value' => array( |
||
840 | 'description' => __( 'Meta value.', 'woocommerce' ), |
||
841 | 'type' => 'mixed', |
||
842 | 'context' => array( 'view', 'edit' ), |
||
843 | ), |
||
844 | ), |
||
845 | ), |
||
846 | ), |
||
847 | ), |
||
848 | ), |
||
849 | ), |
||
850 | 'shipping_lines' => array( |
||
851 | 'description' => __( 'Shipping lines data.', 'woocommerce' ), |
||
852 | 'type' => 'array', |
||
853 | 'context' => array( 'view', 'edit' ), |
||
854 | 'items' => array( |
||
855 | 'type' => 'object', |
||
856 | 'properties' => array( |
||
857 | 'id' => array( |
||
858 | 'description' => __( 'Item ID.', 'woocommerce' ), |
||
859 | 'type' => 'integer', |
||
860 | 'context' => array( 'view', 'edit' ), |
||
861 | 'readonly' => true, |
||
862 | ), |
||
863 | 'method_title' => array( |
||
864 | 'description' => __( 'Shipping method name.', 'woocommerce' ), |
||
865 | 'type' => 'mixed', |
||
866 | 'context' => array( 'view', 'edit' ), |
||
867 | ), |
||
868 | 'method_id' => array( |
||
869 | 'description' => __( 'Shipping method ID.', 'woocommerce' ), |
||
870 | 'type' => 'mixed', |
||
871 | 'context' => array( 'view', 'edit' ), |
||
872 | ), |
||
873 | 'instance_id' => array( |
||
874 | 'description' => __( 'Shipping instance ID.', 'woocommerce' ), |
||
875 | 'type' => 'string', |
||
876 | 'context' => array( 'view', 'edit' ), |
||
877 | ), |
||
878 | 'total' => array( |
||
879 | 'description' => __( 'Line total (after discounts).', 'woocommerce' ), |
||
880 | 'type' => 'string', |
||
881 | 'context' => array( 'view', 'edit' ), |
||
882 | ), |
||
883 | 'total_tax' => array( |
||
884 | 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), |
||
885 | 'type' => 'string', |
||
886 | 'context' => array( 'view', 'edit' ), |
||
887 | 'readonly' => true, |
||
888 | ), |
||
889 | 'taxes' => array( |
||
890 | 'description' => __( 'Line taxes.', 'woocommerce' ), |
||
891 | 'type' => 'array', |
||
892 | 'context' => array( 'view', 'edit' ), |
||
893 | 'readonly' => true, |
||
894 | 'items' => array( |
||
895 | 'type' => 'object', |
||
896 | 'properties' => array( |
||
897 | 'id' => array( |
||
898 | 'description' => __( 'Tax rate ID.', 'woocommerce' ), |
||
899 | 'type' => 'integer', |
||
900 | 'context' => array( 'view', 'edit' ), |
||
901 | 'readonly' => true, |
||
902 | ), |
||
903 | 'total' => array( |
||
904 | 'description' => __( 'Tax total.', 'woocommerce' ), |
||
905 | 'type' => 'string', |
||
906 | 'context' => array( 'view', 'edit' ), |
||
907 | 'readonly' => true, |
||
908 | ), |
||
909 | ), |
||
910 | ), |
||
911 | ), |
||
912 | 'meta_data' => array( |
||
913 | 'description' => __( 'Meta data.', 'woocommerce' ), |
||
914 | 'type' => 'array', |
||
915 | 'context' => array( 'view', 'edit' ), |
||
916 | 'items' => array( |
||
917 | 'type' => 'object', |
||
918 | 'properties' => array( |
||
919 | 'id' => array( |
||
920 | 'description' => __( 'Meta ID.', 'woocommerce' ), |
||
921 | 'type' => 'integer', |
||
922 | 'context' => array( 'view', 'edit' ), |
||
923 | 'readonly' => true, |
||
924 | ), |
||
925 | 'key' => array( |
||
926 | 'description' => __( 'Meta key.', 'woocommerce' ), |
||
927 | 'type' => 'string', |
||
928 | 'context' => array( 'view', 'edit' ), |
||
929 | ), |
||
930 | 'value' => array( |
||
931 | 'description' => __( 'Meta value.', 'woocommerce' ), |
||
932 | 'type' => 'mixed', |
||
933 | 'context' => array( 'view', 'edit' ), |
||
934 | ), |
||
935 | ), |
||
936 | ), |
||
937 | ), |
||
938 | ), |
||
939 | ), |
||
940 | ), |
||
941 | 'fee_lines' => array( |
||
942 | 'description' => __( 'Fee lines data.', 'woocommerce' ), |
||
943 | 'type' => 'array', |
||
944 | 'context' => array( 'view', 'edit' ), |
||
945 | 'items' => array( |
||
946 | 'type' => 'object', |
||
947 | 'properties' => array( |
||
948 | 'id' => array( |
||
949 | 'description' => __( 'Item ID.', 'woocommerce' ), |
||
950 | 'type' => 'integer', |
||
951 | 'context' => array( 'view', 'edit' ), |
||
952 | 'readonly' => true, |
||
953 | ), |
||
954 | 'name' => array( |
||
955 | 'description' => __( 'Fee name.', 'woocommerce' ), |
||
956 | 'type' => 'mixed', |
||
957 | 'context' => array( 'view', 'edit' ), |
||
958 | ), |
||
959 | 'tax_class' => array( |
||
960 | 'description' => __( 'Tax class of fee.', 'woocommerce' ), |
||
961 | 'type' => 'string', |
||
962 | 'context' => array( 'view', 'edit' ), |
||
963 | ), |
||
964 | 'tax_status' => array( |
||
965 | 'description' => __( 'Tax status of fee.', 'woocommerce' ), |
||
966 | 'type' => 'string', |
||
967 | 'context' => array( 'view', 'edit' ), |
||
968 | 'enum' => array( 'taxable', 'none' ), |
||
969 | ), |
||
970 | 'total' => array( |
||
971 | 'description' => __( 'Line total (after discounts).', 'woocommerce' ), |
||
972 | 'type' => 'string', |
||
973 | 'context' => array( 'view', 'edit' ), |
||
974 | ), |
||
975 | 'total_tax' => array( |
||
976 | 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ), |
||
977 | 'type' => 'string', |
||
978 | 'context' => array( 'view', 'edit' ), |
||
979 | 'readonly' => true, |
||
980 | ), |
||
981 | 'taxes' => array( |
||
982 | 'description' => __( 'Line taxes.', 'woocommerce' ), |
||
983 | 'type' => 'array', |
||
984 | 'context' => array( 'view', 'edit' ), |
||
985 | 'readonly' => true, |
||
986 | 'items' => array( |
||
987 | 'type' => 'object', |
||
988 | 'properties' => array( |
||
989 | 'id' => array( |
||
990 | 'description' => __( 'Tax rate ID.', 'woocommerce' ), |
||
991 | 'type' => 'integer', |
||
992 | 'context' => array( 'view', 'edit' ), |
||
993 | 'readonly' => true, |
||
994 | ), |
||
995 | 'total' => array( |
||
996 | 'description' => __( 'Tax total.', 'woocommerce' ), |
||
997 | 'type' => 'string', |
||
998 | 'context' => array( 'view', 'edit' ), |
||
999 | 'readonly' => true, |
||
1000 | ), |
||
1001 | 'subtotal' => array( |
||
1002 | 'description' => __( 'Tax subtotal.', 'woocommerce' ), |
||
1003 | 'type' => 'string', |
||
1004 | 'context' => array( 'view', 'edit' ), |
||
1005 | 'readonly' => true, |
||
1006 | ), |
||
1007 | ), |
||
1008 | ), |
||
1009 | ), |
||
1010 | 'meta_data' => array( |
||
1011 | 'description' => __( 'Meta data.', 'woocommerce' ), |
||
1012 | 'type' => 'array', |
||
1013 | 'context' => array( 'view', 'edit' ), |
||
1014 | 'items' => array( |
||
1015 | 'type' => 'object', |
||
1016 | 'properties' => array( |
||
1017 | 'id' => array( |
||
1018 | 'description' => __( 'Meta ID.', 'woocommerce' ), |
||
1019 | 'type' => 'integer', |
||
1020 | 'context' => array( 'view', 'edit' ), |
||
1021 | 'readonly' => true, |
||
1022 | ), |
||
1023 | 'key' => array( |
||
1024 | 'description' => __( 'Meta key.', 'woocommerce' ), |
||
1025 | 'type' => 'string', |
||
1026 | 'context' => array( 'view', 'edit' ), |
||
1027 | ), |
||
1028 | 'value' => array( |
||
1029 | 'description' => __( 'Meta value.', 'woocommerce' ), |
||
1030 | 'type' => 'mixed', |
||
1031 | 'context' => array( 'view', 'edit' ), |
||
1032 | ), |
||
1033 | ), |
||
1034 | ), |
||
1035 | ), |
||
1036 | ), |
||
1037 | ), |
||
1038 | ), |
||
1039 | 'coupon_lines' => array( |
||
1040 | 'description' => __( 'Coupons line data.', 'woocommerce' ), |
||
1041 | 'type' => 'array', |
||
1042 | 'context' => array( 'view', 'edit' ), |
||
1043 | 'items' => array( |
||
1044 | 'type' => 'object', |
||
1045 | 'properties' => array( |
||
1046 | 'id' => array( |
||
1047 | 'description' => __( 'Item ID.', 'woocommerce' ), |
||
1048 | 'type' => 'integer', |
||
1049 | 'context' => array( 'view', 'edit' ), |
||
1050 | 'readonly' => true, |
||
1051 | ), |
||
1052 | 'code' => array( |
||
1053 | 'description' => __( 'Coupon code.', 'woocommerce' ), |
||
1054 | 'type' => 'mixed', |
||
1055 | 'context' => array( 'view', 'edit' ), |
||
1056 | ), |
||
1057 | 'discount' => array( |
||
1058 | 'description' => __( 'Discount total.', 'woocommerce' ), |
||
1059 | 'type' => 'string', |
||
1060 | 'context' => array( 'view', 'edit' ), |
||
1061 | 'readonly' => true, |
||
1062 | ), |
||
1063 | 'discount_tax' => array( |
||
1064 | 'description' => __( 'Discount total tax.', 'woocommerce' ), |
||
1065 | 'type' => 'string', |
||
1066 | 'context' => array( 'view', 'edit' ), |
||
1067 | 'readonly' => true, |
||
1068 | ), |
||
1069 | 'meta_data' => array( |
||
1070 | 'description' => __( 'Meta data.', 'woocommerce' ), |
||
1071 | 'type' => 'array', |
||
1072 | 'context' => array( 'view', 'edit' ), |
||
1073 | 'items' => array( |
||
1074 | 'type' => 'object', |
||
1075 | 'properties' => array( |
||
1076 | 'id' => array( |
||
1077 | 'description' => __( 'Meta ID.', 'woocommerce' ), |
||
1078 | 'type' => 'integer', |
||
1079 | 'context' => array( 'view', 'edit' ), |
||
1080 | 'readonly' => true, |
||
1081 | ), |
||
1082 | 'key' => array( |
||
1083 | 'description' => __( 'Meta key.', 'woocommerce' ), |
||
1084 | 'type' => 'string', |
||
1085 | 'context' => array( 'view', 'edit' ), |
||
1086 | ), |
||
1087 | 'value' => array( |
||
1088 | 'description' => __( 'Meta value.', 'woocommerce' ), |
||
1089 | 'type' => 'mixed', |
||
1090 | 'context' => array( 'view', 'edit' ), |
||
1091 | ), |
||
1092 | ), |
||
1093 | ), |
||
1094 | ), |
||
1095 | ), |
||
1096 | ), |
||
1097 | ), |
||
1098 | 'refunds' => array( |
||
1099 | 'description' => __( 'List of refunds.', 'woocommerce' ), |
||
1100 | 'type' => 'array', |
||
1101 | 'context' => array( 'view', 'edit' ), |
||
1102 | 'readonly' => true, |
||
1103 | 'items' => array( |
||
1104 | 'type' => 'object', |
||
1105 | 'properties' => array( |
||
1106 | 'id' => array( |
||
1107 | 'description' => __( 'Refund ID.', 'woocommerce' ), |
||
1108 | 'type' => 'integer', |
||
1109 | 'context' => array( 'view', 'edit' ), |
||
1110 | 'readonly' => true, |
||
1111 | ), |
||
1112 | 'reason' => array( |
||
1113 | 'description' => __( 'Refund reason.', 'woocommerce' ), |
||
1114 | 'type' => 'string', |
||
1115 | 'context' => array( 'view', 'edit' ), |
||
1116 | 'readonly' => true, |
||
1117 | ), |
||
1118 | 'total' => array( |
||
1119 | 'description' => __( 'Refund total.', 'woocommerce' ), |
||
1120 | 'type' => 'string', |
||
1121 | 'context' => array( 'view', 'edit' ), |
||
1122 | 'readonly' => true, |
||
1123 | ), |
||
1124 | ), |
||
1125 | ), |
||
1126 | ), |
||
1127 | 'set_paid' => array( |
||
1128 | 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce' ), |
||
1129 | 'type' => 'boolean', |
||
1130 | 'default' => false, |
||
1131 | 'context' => array( 'edit' ), |
||
1132 | ), |
||
1133 | ), |
||
1134 | ); |
||
1135 | |||
1136 | return $this->add_additional_fields_schema( $schema ); |
||
1137 | } |
||
1186 |