Skip to content

Commit

Permalink
Merge pull request #21 from smartsendio/develop
Browse files Browse the repository at this point in the history
v8.0.25
  • Loading branch information
bilfeldt authored Oct 25, 2021
2 parents f59fbeb + 43b29f1 commit dab12c1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
16 changes: 11 additions & 5 deletions smart-send-logistics/includes/class-ss-shipping-shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,18 @@ protected function make_single_shipment_api_payload( $return )
$this->getOrderId($this->order)
);

// If shipping phone number doesn't exist, try to get billing phone number
if (!isset($shipping_address['phone']) && isset($billing_address['phone'])) {
$shipping_address['phone'] = $billing_address['phone'];
// The shipping phone field was added in WooCommerce 5.6 but often added by hooks/plugins before that.
// Note that the field is not shown on checkout per default but can be enabled by filters/plugins.
// See: https://github.com/woocommerce/woocommerce/pull/30097#issuecomment-943114632
if (isset($shipping_address['phone']) && $shipping_address['phone']) { // Field did not exist prior to WooCommerce 5.6
$phone = $shipping_address['phone'];
} elseif ($shipping_address['country'] == $billing_address['country']) { // Require as only local phone numbers is accepted
$phone = $billing_address['phone'];
} else {
$phone = null;
}

// If shipping email doesn't exist, try to get billing email
// The shipping email field does not exist in default WP installations but can be added by filters/hooks.
if (!isset($shipping_address['email']) && isset($billing_address['email'])) {
$shipping_address['email'] = $billing_address['email'];
}
Expand All @@ -185,7 +191,7 @@ protected function make_single_shipment_api_payload( $return )
->setPostalCode($shipping_address['postcode'] ?: null)
->setCity($shipping_address['city'] ?: null)
->setCountry($shipping_address['country'] ?: null)
->setSms($shipping_address['phone'] ?: null)
->setSms($phone ?: null)
->setEmail($shipping_address['email'] ?: null);

// Add the receiver to the shipment
Expand Down
5 changes: 4 additions & 1 deletion smart-send-logistics/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Developer URI: https://smartsend.io/
Tags: smartsend, smart send, shipping, shipping label, pickup, pick-up, pakkelabel, pakkelabels, pakkeboks, pakkeshop, hente selv, døgnboks, postnord, post nord, post danmark, gls, swipbox, bring, dao, dao365, dao 365, carrier, pacsoft, yourgls, mybring, postage, shipping method, your-gls, my-bring, pacosft-online, pacsoftonline, denmark, sweeden, posten, norway, post
Requires at least: 3.0.1
Tested up to: 5.9
Stable tag: 8.0.24
Stable tag: 8.0.25
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
WC requires at least: 3.0.0
Expand Down Expand Up @@ -200,6 +200,9 @@ This box appears when a "Select Pick-up Point" shipping method is selected, but

== Changelog ==

= 8.0.25 =
* Fix issue with missing receiver phone on some WooCommerce versions (v5.6+)

= 8.0.24 =
* Add filter smart_send_sslverify to fix ssl issues on older servers with incorrect SSL libraries

Expand Down
4 changes: 2 additions & 2 deletions smart-send-logistics/smart-send-logistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: Smart Send ApS
* Author URI: https://www.smartsend.io
* Text Domain: smart-send-logistics
* Version: 8.0.24
* Version: 8.0.25
* WC requires at least: 3.0.1
* WC tested up to: 5.1
*
Expand Down Expand Up @@ -34,7 +34,7 @@
class SS_Shipping_WC
{

private $version = "8.0.24";
private $version = "8.0.25";

/**
* Instance to call certain functions globally within the plugin
Expand Down

0 comments on commit dab12c1

Please sign in to comment.