Skip to content

Commit

Permalink
Fix issue reading value when set programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-H committed Mar 29, 2024
1 parent cb5f18f commit c1c19a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions core/components/commerce_dynamictaxmode/docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Dynamictaxmode for Commerce 1.0.0-rc3
---------------------------------
Released on 2024-03-29

- Make sure programmatically setting/getting value works as expected

Dynamictaxmode for Commerce 1.0.0-rc2
---------------------------------
Released on 2024-03-21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ protected function checkPricingInstance(comCurrency $currency, ProductPricing $i
*/
public function getRawBusinessPricing(): array
{
return $this->getProperty('pricing_business') ?? [];
$raw = $this->getProperty('pricing_business');
$raw = is_array($raw) ? $raw : json_decode($raw, true);
return $raw ?: [];
}

/**
Expand All @@ -190,7 +192,7 @@ public function getRawBusinessPricing(): array
*/
protected function setRawBusinessPricing(array $pricing)
{
$this->setProperty('pricing_business', json_encode($pricing));
$this->setProperty('pricing_business', $pricing);
}

/**
Expand Down

0 comments on commit c1c19a4

Please sign in to comment.