Skip to content

Commit

Permalink
refactor: slightly change if statement and variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianSDV committed Aug 2, 2024
1 parent 0f51f9d commit 9b9e442
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Hooks/CheckoutScriptHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ private function shouldShowDeliveryOptions(): bool

$showDeliveryOptions = false;

$deliveryOptionsEnabledWhenNotInStock = Settings::get(
$deliveryOptionsEnabledWhenOnBackorder = Settings::get(
CheckoutSettings::ENABLE_DELIVERY_OPTIONS_WHEN_NOT_IN_STOCK,
CheckoutSettings::ID
);
Expand All @@ -204,10 +204,10 @@ private function shouldShowDeliveryOptions(): bool
/** @var WC_Product $product */
$product = $cartItem['data'];

$productIsNotVirtual = ! $product->is_virtual();
$productNotOnBackorder = ! $product->is_on_backorder($cartItem['quantity']);
$productIsVirtual = $product->is_virtual();
$productOnBackorder = $product->is_on_backorder($cartItem['quantity']);

if ($productIsNotVirtual && ($productNotOnBackorder || $deliveryOptionsEnabledWhenNotInStock)) {
if (! $productIsVirtual && (! $productOnBackorder || $deliveryOptionsEnabledWhenOnBackorder)) {
$showDeliveryOptions = true;
break;
}
Expand Down

0 comments on commit 9b9e442

Please sign in to comment.