File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -359,7 +359,7 @@ public function stockWithVariants(): int|string
359359 */
360360 public function stock (?string $ withHold = null , ?string $ variant = null ): int |string
361361 {
362- /** @var StocksPage $stocks */
362+ /** @var StocksPage|null $stocks */
363363 $ stocks = kart ()->page (ContentPageEnum::STOCKS );
364364
365365 return $ stocks ?->stock($ this ->uuid ()->toString (), $ withHold , $ variant ) ?? '∞ ' ;
@@ -745,6 +745,10 @@ public function pricesForVariants(bool $mustBeInStock = true): array
745745
746746 public function priceWithVariant (?string $ variant = null ): float
747747 {
748+ if (empty ($ variant )) {
749+ return $ this ->price ()->toFloat ();
750+ }
751+
748752 $ variants = array_map ('trim ' , explode (', ' , $ variant ));
749753 sort ($ variants );
750754 $ variant = implode (', ' , $ variants );
You can’t perform that action at this time.
0 commit comments