BF checkout session

This commit is contained in:
Fabian @ Blax Software 2025-12-29 08:14:58 +01:00
parent 76d60c328b
commit adbc3d89bf
1 changed files with 4 additions and 2 deletions

View File

@ -1879,13 +1879,14 @@ class Cart extends Model
$product = $item->purchasable; $product = $item->purchasable;
// Get product name (use short_description if available, otherwise name) // Get product name (use short_description if available, otherwise name)
$productName = $product->short_description ?? $product->name ?? 'Product'; $productName = $product->name ?? 'Product [' . $product->id . ']';
$description = $product->short_description ?? null;
// Build description with booking dates if available // Build description with booking dates if available
if ($item->from && $item->until) { if ($item->from && $item->until) {
$fromFormatted = $item->from->format('M j, Y H:i'); $fromFormatted = $item->from->format('M j, Y H:i');
$untilFormatted = $item->until->format('M j, Y H:i'); $untilFormatted = $item->until->format('M j, Y H:i');
$productName .= " from {$fromFormatted} to {$untilFormatted}"; $description .= " from {$fromFormatted} to {$untilFormatted}";
} }
// Price is already stored in cents, Stripe expects smallest currency unit // Price is already stored in cents, Stripe expects smallest currency unit
@ -1897,6 +1898,7 @@ class Cart extends Model
'currency' => config('shop.currency', 'usd'), 'currency' => config('shop.currency', 'usd'),
'product_data' => [ 'product_data' => [
'name' => $productName, 'name' => $productName,
...($description ? ['description' => $description] : []),
], ],
'unit_amount' => $unitAmountCents, 'unit_amount' => $unitAmountCents,
], ],