← All changes
|
src/Shortcodes/OrderDetails/OrderDetailsShortcodes.php
+12
-8
4.4.2
→
4.4.5
View file →
| @@ -481,9 +481,9 @@ | ||
| 481 | 481 | if ( ! empty( $render_data['is_sample'] ) ) { |
| 482 | 482 | /** |
| 483 | 483 | * Is sample order |
| 484 | 484 | */ |
| 485 | - return date_i18n( wc_date_format() ); | |
| 485 | + return date_i18n( function_exists( 'wc_date_format' ) ? wc_date_format() : get_option( 'date_format' ) ); | |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | $order = Helpers::get_order_from_shortcode_data( $render_data ); |
| 489 | 489 | |
| @@ -499,9 +499,9 @@ | ||
| 499 | 499 | if ( empty( $order_created_date ) ) { |
| 500 | 500 | return ''; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - return $order_created_date->date_i18n( wc_date_format() ); | |
| 503 | + return $order_created_date->date_i18n( function_exists( 'wc_date_format' ) ? wc_date_format() : get_option( 'date_format' ) ); | |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | public function yaymail_order_status( $data ) { |
| 507 | 507 | $render_data = isset( $data['render_data'] ) ? $data['render_data'] : []; |
| @@ -797,12 +797,14 @@ | ||
| 797 | 797 | |
| 798 | 798 | $products_in_order = []; |
| 799 | 799 | foreach ( $order->get_items() as $item ) { |
| 800 | 800 | $product = $item->get_product(); |
| 801 | - if ( $product->is_type( 'variation' ) ) { | |
| 802 | - $products_in_order[] = $product->get_parent_id(); | |
| 803 | - } else { | |
| 804 | - $products_in_order[] = $product->get_id(); | |
| 801 | + if ( ! empty( $product ) ) { | |
| 802 | + if ( $product->is_type( 'variation' ) ) { | |
| 803 | + $products_in_order[] = $product->get_parent_id(); | |
| 804 | + } else { | |
| 805 | + $products_in_order[] = $product->get_id(); | |
| 806 | + } | |
| 805 | 807 | } |
| 806 | 808 | } |
| 807 | 809 | |
| 808 | 810 | return count( array_unique( $products_in_order ) ); |
| @@ -828,10 +830,12 @@ | ||
| 828 | 830 | } |
| 829 | 831 | |
| 830 | 832 | $products_in_order = []; |
| 831 | 833 | foreach ( $order->get_items() as $item ) { |
| 832 | - $product = $item->get_product(); | |
| 833 | - $products_in_order[] = $product->get_id(); | |
| 834 | + $product = $item->get_product(); | |
| 835 | + if ( ! empty( $product ) ) { | |
| 836 | + $products_in_order[] = $product->get_id(); | |
| 837 | + } | |
| 834 | 838 | } |
| 835 | 839 | |
| 836 | 840 | return count( array_unique( $products_in_order ) ); |
| 837 | 841 | } |