Skip to content

Commit

Permalink
refactor: use variable in loop
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianSDV authored and EdieLemoine committed Jul 24, 2024
1 parent b16f303 commit 031f62f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Hooks/CheckoutScriptHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,14 @@ private function shouldShowDeliveryOptions(): bool
/** @var WC_Product $product */
$product = $cartItem['data'];

$deliveryOptionsEnabledWhenNotInStock = Settings::get(
CheckoutSettings::ENABLE_DELIVERY_OPTIONS_WHEN_NOT_IN_STOCK,
CheckoutSettings::ID

Check warning on line 204 in src/Hooks/CheckoutScriptHooks.php

View check run for this annotation

Codecov / codecov/patch

src/Hooks/CheckoutScriptHooks.php#L202-L204

Added lines #L202 - L204 were not covered by tests
);

if (! $product->is_virtual()
&& (! $product->is_on_backorder($cartItem['quantity'])
|| Settings::get(
CheckoutSettings::ENABLE_DELIVERY_OPTIONS_WHEN_NOT_IN_STOCK,
CheckoutSettings::ID
))) {
&& ($deliveryOptionsEnabledWhenNotInStock
|| ! $product->is_on_backorder($cartItem['quantity']))) {

Check warning on line 209 in src/Hooks/CheckoutScriptHooks.php

View check run for this annotation

Codecov / codecov/patch

src/Hooks/CheckoutScriptHooks.php#L207-L209

Added lines #L207 - L209 were not covered by tests
$showDeliveryOptions = true;
break;
}
Expand Down

0 comments on commit 031f62f

Please sign in to comment.