Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Plugin/Quote/Address/Total/ShippingPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public function aroundCollect(

if (!$this->customShippingRateHelper->isEnabled($storeId)
|| $address->getAddressType() != Address::ADDRESS_TYPE_SHIPPING
|| strpos((string) $method, Carrier::CODE) === false
|| !str_contains((string) $method, Carrier::CODE)
) {
return $proceed($quote, $shippingAssignment, $total);
}

$customShippingOption = $this->getCustomShippingJsonToArray($method, $address, $storeId);

if ($customShippingOption && strpos((string) $method, $customShippingOption['code']) !== false) {
if ($customShippingOption && str_contains((string) $method, (string) $customShippingOption['code'])) {
//update shipping code
$shipping->setMethod($customShippingOption['code']);
$address->setShippingMethod($customShippingOption['code']);
Expand All @@ -79,7 +79,7 @@ protected function updateCustomRate($address, $customShippingOption)
{
if ($selectedRate = $this->getSelectedShippingRate($address, $customShippingOption['code'])) {
$cost = (float) $customShippingOption['rate'];
$description = trim($customShippingOption['description']);
$description = trim((string) $customShippingOption['description']);

$selectedRate->setPrice($cost);
$selectedRate->setCost($cost);
Expand Down Expand Up @@ -116,7 +116,7 @@ private function getCustomShippingJsonToArray($json, $address, $storeId = null)
return $this->formatShippingArray($jsonToArray);
}

$jsonToArray = (array)json_decode($json, true);
$jsonToArray = (array)json_decode((string) $json, true);

if (is_array($jsonToArray) && count($jsonToArray) == 4) {
return $this->formatShippingArray($jsonToArray);
Expand Down
7 changes: 2 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"free shipping"
],
"type": "magento2-module",
"version": "1.8.2",
"version": "1.8.3",
"license": [
"proprietary"
],
Expand All @@ -36,10 +36,7 @@
}
],
"require": {
"php": "~8.1.0|~8.2.0|~8.3.0",
"magento/module-backend": "102.0.*",
"magento/framework": "103.0.*",
"magepal/magento2-core": ">=1.1.10"
"php": "~8.3.0|~8.4.0"
},
"autoload": {
"files": [
Expand Down
17 changes: 17 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__ . '/',
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_84
]);
};