$product */ /** @var array> $variants */ /** @var array> $images */ $mainImage = $product['main_image_path'] ?? ''; $showUnitPriceForVariant = static function (array $variant) use ($product): bool { if (function_exists('product_should_show_unit_price')) { return product_should_show_unit_price($product, $variant); } $unit = (string) ($variant['unit'] ?? $product['base_unit'] ?? ''); if (!in_array($unit, ['kg', 'кг'], true)) { return false; } if (($variant['price_per_unit'] ?? null) === null || (float) $variant['price_per_unit'] <= 0) { return false; } $packageQuantity = (float) ($variant['package_quantity'] ?? 0); if ($packageQuantity < 1) { return false; } $lower = static function (string $value): string { return function_exists('mb_strtolower') ? mb_strtolower($value, 'UTF-8') : strtolower($value); }; return preg_match('/(^|[\s,.;])\d+(?:[.,]\d+)?\s*(мл|шт)\.?($|[\s,.;])/u', $lower((string) ($variant['name'] ?? ''))) !== 1; }; ?>

Фасовки

/ За фасовку

Описание