Changeset 3746418 for fluent-cart/trunk/app/Models/Subscription.php
- Timestamp:
- 10/14/2026 01:03:30 PM (6 days ago)
- File:
-
- 1 edited
-
fluent-cart/trunk/app/Models/Subscription.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fluent-cart/trunk/app/Models/Subscription.php
r3719064 r3746418 3 3 namespace FluentCart\App\Models; 4 4 5 use FluentCart\Api\CurrencySettings; 5 use FluentCart\App\Modules\MultiCurrency\Services\BaseCurrency; 6 use FluentCart\App\Modules\MultiCurrency\Services\CurrencySnapshot; 6 7 use FluentCart\Api\StoreSettings; 7 8 use FluentCart\App\App; … … 51 52 'product_id', 52 53 'item_name', 54 'currency', 53 55 'variation_id', 54 56 'billing_interval', … … 84 86 $model->uuid = md5(time() . wp_generate_uuid4()); 85 87 } 88 89 // Currency column + the parent order's snapshot, which renewals carry. 90 CurrencySnapshot::applyToNewSubscription($model); 86 91 }); 87 92 } … … 418 423 public function getCurrencyAttribute(): string 419 424 { 420 $currency = ''; 421 422 if (empty($this->config)) { 423 // get from store settings 424 $currency = CurrencySettings::get('currency'); 425 return strtoupper($currency); 426 } 427 428 $definedCurrency = Arr::get($this->config, 'currency', ''); 429 430 if(empty($definedCurrency)) { 431 $currency = CurrencySettings::get('currency'); 432 return strtoupper($currency); 433 } 434 435 return strtoupper($definedCurrency); 425 $column = (string) Arr::get($this->attributes, 'currency', ''); 426 if ($column !== '') { 427 return strtoupper($column); 428 } 429 430 $definedCurrency = Arr::get((array) $this->config, 'currency', ''); 431 if ($definedCurrency) { 432 return strtoupper($definedCurrency); 433 } 434 435 // Not CurrencySettings::get(): on storefront requests that is the visitor's currency 436 $parentCurrency = $this->parent_order_id 437 ? Order::query()->where('id', $this->parent_order_id)->value('currency') 438 : ''; 439 if ($parentCurrency) { 440 return strtoupper($parentCurrency); 441 } 442 443 return BaseCurrency::get(); 436 444 } 437 445
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)