Skip to content

Commit

Permalink
v1.2.3: Fixes for the WooCommerce subscriptions plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
fean committed Feb 7, 2022
1 parent 0937417 commit 2f9b12d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
1 change: 1 addition & 0 deletions includes/wc-internal/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
require_once('track-trace.php');
require_once('trunkrs-order.php');
require_once('shipment-tracking.php');
require_once('subscriptions.php');
5 changes: 2 additions & 3 deletions includes/wc-internal/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ public function renewalPaymentComplete($subscription, $order)
if (!TRUNKRS_WC_Settings::getUseSubscriptionRenewals())
return;

$initialOrder = new TRUNKRS_WC_Order($subscription);

$initialOrder = new TRUNKRS_WC_Order($subscription, true, true);
if (!$initialOrder->isTrunkrsOrder) return;

$newOrder = new TRUNKRS_WC_Order($order);
$newOrder->announceShipment();
$newOrder->announceShipment(true);
}
}
}
Expand Down
19 changes: 14 additions & 5 deletions includes/wc-internal/trunkrs-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,18 @@ private function getDeliveryDate($item)

if (isset($deliveryDatePlugin)) {
$parsed = DateTime::createFromFormat('U', $deliveryDatePlugin['value']);
if ($parsed === false) return $item->get_meta(self::DELIVERY_DATE_KEY);
if ($parsed === false) {
return !isset($item)
? null
: $item->get_meta(self::DELIVERY_DATE_KEY);
}

return TRUNKRS_WC_Utils::format8601Date($parsed);
}

return $item->get_meta(self::DELIVERY_DATE_KEY);
return !isset($item)
? null
: $item->get_meta(self::DELIVERY_DATE_KEY);
}

/**
Expand Down Expand Up @@ -187,10 +194,12 @@ public function announceShipment(bool $force = false)
$reference = $this->order->get_order_key();
$shipment = TRUNKRS_WC_Api::announceShipment($this->order, $reference, $deliveryDate);

$shippingItem->delete_meta_data(self::DELIVERY_DATE_KEY);
$shippingItem->delete_meta_data(self::CUT_OFF_TIME_KEY);
if (isset($shippingItem)) {
$shippingItem->delete_meta_data(self::DELIVERY_DATE_KEY);
$shippingItem->delete_meta_data(self::CUT_OFF_TIME_KEY);

$shippingItem->save_meta_data();
$shippingItem->save_meta_data();
}

if (is_null($shipment)) {
$this->isAnnounceFailed = true;
Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: fean
Tags: delivery, packages, woocommerce, trunkrs, sameday, delivery
Requires at least: 3.6 & WooCommerce 3.0+
Tested up to: 5.9
Stable tag: 1.2.0
Stable tag: 1.2.3
Requires PHP: 7.1
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -41,6 +41,12 @@ Reach out to your customer success manager or account manager to get started, th

== Changelog ==

= 1.2.3 =
We fixed an issue with the WooCommerce subscriptions plugin where we didn't pick up the correct shipment details on subscription renewals.

= 1.2.2 =
Several small fixes to the new plugin features. Support for both the lite and pro versions of the Order Delivery Date plugin.

= 1.2.0 =
This is a big release with lots of new and cool features you will love!
We added the following features:
Expand Down
4 changes: 2 additions & 2 deletions trunkrs-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: Add excellent consumer focused shipping to your WooCommerce store.
* Author: Trunkrs
* Author URI: https://trunkrs.nl
* Version: 1.2.0
* Version: 1.2.3
* Requires at least: 3.6 & WooCommerce 3.0+
* Requires PHP: 7.1
* License: GPLv3
Expand All @@ -23,7 +23,7 @@ class TRUNKRS_WC_Bootstrapper
/**
* @var string The semver version of the plugin.
*/
public $version = '1.1.0';
public $version = '1.2.3';

/**
* @var TRUNKRS_WC_Bootstrapper The shared plugin instance.
Expand Down

0 comments on commit 2f9b12d

Please sign in to comment.