Skip to content

Commit

Permalink
Fixes #3279
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Oct 18, 2023
1 parent 8b8920a commit 94dd13e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fixed an XSS vulnerability.
- Fixed a bug where emails were not being ordered by name correctly. ([#3263](https://github.com/craftcms/commerce/issues/3263))
- Fixed a bug where a gateway’s webhook URL was malformed. ([#3299](https://github.com/craftcms/commerce/issues/3299))
- The order param is now included when triggering the `craft\commerce\services\Purchasables::EVENT_PURCHASABLE_SHIPPABLE` event. ([#3279](https://github.com/craftcms/commerce/pull/3279))

## 3.4.22.1 - 2023-06-03

Expand Down
4 changes: 2 additions & 2 deletions src/adjusters/Shipping.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function adjust(Order $order): array

foreach ($lineItems as $item) {
$purchasable = $item->getPurchasable();
if ($purchasable && !Plugin::getInstance()->getPurchasables()->isPurchasableShippable($purchasable)) {
if ($purchasable && !Plugin::getInstance()->getPurchasables()->isPurchasableShippable($purchasable, $order)) {
$nonShippableItems[$item->id] = $item->id;
}
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public function adjust(Order $order): array
}

$freeShippingFlagOnProduct = $item->purchasable->hasFreeShipping();
$shippable = Plugin::getInstance()->getPurchasables()->isPurchasableShippable($item->getPurchasable());
$shippable = Plugin::getInstance()->getPurchasables()->isPurchasableShippable($item->getPurchasable(), $order);
if (!$freeShippingFlagOnProduct && !$hasFreeShippingFromDiscount && $shippable) {
$adjustment = $this->_createAdjustment($shippingMethod, $rule);

Expand Down
4 changes: 2 additions & 2 deletions src/base/ShippingMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function getPriceForOrder(Order $order)

foreach ($lineItems as $item) {
$purchasable = $item->getPurchasable();
if ($purchasable && !Plugin::getInstance()->getPurchasables()->isPurchasableShippable($purchasable)) {
if ($purchasable && !Plugin::getInstance()->getPurchasables()->isPurchasableShippable($purchasable, $order)) {
$nonShippableItems[$item->id] = $item->id;
}
}
Expand All @@ -175,7 +175,7 @@ public function getPriceForOrder(Order $order)
$amount = $shippingRule->getBaseRate();

foreach ($order->lineItems as $item) {
if ($item->getPurchasable() && !$item->purchasable->hasFreeShipping() && Plugin::getInstance()->getPurchasables()->isPurchasableShippable($item->getPurchasable())) {
if ($item->getPurchasable() && !$item->purchasable->hasFreeShipping() && Plugin::getInstance()->getPurchasables()->isPurchasableShippable($item->getPurchasable(), $order)) {
$percentageRate = $shippingRule->getPercentageRate($item->shippingCategoryId);
$perItemRate = $shippingRule->getPerItemRate($item->shippingCategoryId);
$weightRate = $shippingRule->getWeightRate($item->shippingCategoryId);
Expand Down

0 comments on commit 94dd13e

Please sign in to comment.