diff --git a/readme.txt b/readme.txt index f45e5b6..58c186e 100755 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: thrivedesk Tags: livechat, chat, help desk, chat plugin, free live chat, community, helpdesk, chatbot, knowledge base, support, help center, customer care, woocommerce, surecart, freemius, thrivedesk, zendesk, mailchimp Requires at least: 4.9 Tested up to: 6.4 -Stable Tag: 1.2 +Stable Tag: 1.2.1 Requires PHP: 5.5 License: GNU General Public License v2.0 or later @@ -223,6 +223,9 @@ Privacy is our utmost priority, and we designed ThriveDesk in a way that aligned - Easy setup: Setup your Shared Inbox in less than a minute. == Changelog == += 1.2.1 = +- Feat: Woocommerce custom order ID support added. +- Feat: Woocommerce AfterShip plugin support added. = 1.2 = - Fix: User data conflict issue fixed. diff --git a/src/Plugins/WooCommerce.php b/src/Plugins/WooCommerce.php index 87282c7..dc65928 100755 --- a/src/Plugins/WooCommerce.php +++ b/src/Plugins/WooCommerce.php @@ -2,6 +2,7 @@ namespace ThriveDesk\Plugins; +use AfterShip_Actions; use ThriveDesk\Plugin; use WC_Order_Query; use WC_Subscriptions_Product; @@ -22,6 +23,11 @@ final class WooCommerce extends Plugin { */ public $orders = []; + /** + * To store tracking details. + */ + public $tracking = []; + /** * To track the get_orders method is already called or not. */ @@ -153,6 +159,20 @@ public function get_formated_amount( float $amount ): string { return get_woocommerce_currency_symbol() . $amount; } + public function get_tracking_info($order_id){ + if ( in_array( 'aftership-woocommerce-tracking/aftership-woocommerce-tracking.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) { + $afterShip = new AfterShip_Actions(); + $data = $afterShip->get_tracking_items($order_id); + $aftership_tracking_link = $afterShip->generate_tracking_page_link($data[0]) ? $afterShip->generate_tracking_page_link($data[0]) : '#' ; + + if($data){ + $this->tracking = array_merge($this->tracking, array('aftership' => ['data' => $data, 'url' => $aftership_tracking_link])); + } + } + + return $this->tracking; + } + /** * Get the customer orders * @@ -168,7 +188,7 @@ public function get_orders(): array { foreach ( $customer_orders as $order ) { array_push( $this->orders, [ - 'order_id' => $order->get_id(), + 'order_id' => $order->get_order_number(), 'amount' => (float) $order->get_total(), 'amount_formated' => $this->get_formated_amount( $order->get_total() ), 'date' => date( 'd M Y', strtotime( $order->get_date_created() ) ), @@ -176,10 +196,11 @@ public function get_orders(): array { 'shipping' => $this->shipping_param ? $this->get_shipping_details( $order ) : [], 'downloads' => $this->get_order_items( $order ), 'order_url' => method_exists( $order, - 'get_edit_order_url' ) ? $order->get_edit_order_url() : '#', + 'get_edit_order_url' ) ? $order->get_edit_order_url() : '#', 'coupon' => $order->get_coupon_codes() ?? null, - + 'tracking_info' => $this->get_tracking_info( $order->get_id() ), ] ); + $this->tracking = []; } } @@ -208,7 +229,7 @@ public function order_status( $order_id ): array { } return [ - 'order_id' => $order->get_id(), + 'order_id' => $order->get_order_number(), 'amount' => $order->get_total(), 'amount_formatted' => $this->get_formated_amount( $order->get_total() ), 'date' => date( 'd M Y', strtotime( $order->get_date_created() ) ), diff --git a/thrivedesk.php b/thrivedesk.php index e509d43..8573ca5 100755 --- a/thrivedesk.php +++ b/thrivedesk.php @@ -5,7 +5,7 @@ * Description: Live Chat, Help Desk & Knowledge Base plugin for WordPress * Plugin URI: https://www.thrivedesk.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash * Tags: live chat, helpdesk, free live chat, knowledge base, thrivedesk - * Version: 1.2 + * Version: 1.2.1 * Author: ThriveDesk * Author URI: https://profiles.wordpress.org/thrivedesk/ * Text Domain: thrivedesk @@ -50,7 +50,7 @@ final class ThriveDesk * * @var string */ - public $version = '1.2'; + public $version = '1.2.1'; /** * The single instance of this class