|
|
@@ -130,6 +130,10 @@ class CartData
|
|
|
#[ApiProperty(description: 'Formatted VIP member discount amount')]
|
|
|
public ?string $formattedVipPlusAmount = null;
|
|
|
|
|
|
+ #[Groups(['query', 'mutation'])]
|
|
|
+ #[ApiProperty(description: 'Whether the current customer is a VIP member')]
|
|
|
+ public ?bool $isVip = null;
|
|
|
+
|
|
|
#[Groups(['query', 'mutation'])]
|
|
|
public ?bool $success = null;
|
|
|
|
|
|
@@ -313,6 +317,16 @@ class CartData
|
|
|
$data->baseVipPlusAmount = (float) ($cart->base_vip_plus_amount ?? 0);
|
|
|
$data->formattedVipPlusAmount = core()->currency($cart->vip_plus_amount ?? 0);
|
|
|
|
|
|
+ // VIP status
|
|
|
+ $data->isVip = false;
|
|
|
+ if ($cart->customer_id) {
|
|
|
+ $customer = \Webkul\Customer\Models\Customer::find($cart->customer_id);
|
|
|
+ if ($customer && $customer->vip_expire_date) {
|
|
|
+ $expireDate = \Carbon\Carbon::parse($customer->vip_expire_date);
|
|
|
+ $data->isVip = !$expireDate->isPast();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if ($cart->billing_address) {
|
|
|
$data->billingAddress = [
|
|
|
'id' => $cart->billing_address->id,
|