File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
app/code/Magento/CatalogCustomerGraphQl/Model/Resolver Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 19
19
use Magento \Framework \GraphQl \Query \ResolverInterface ;
20
20
use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
21
21
use Magento \Framework \Pricing \PriceCurrencyInterface ;
22
- use Magento \Store \Api \Data \StoreInterface ;
23
22
24
23
/**
25
24
* Resolver for price_tiers
@@ -125,6 +124,10 @@ public function resolve(
125
124
return [];
126
125
}
127
126
127
+ if (!$ product ->getTierPrices ()) {
128
+ return [];
129
+ }
130
+
128
131
$ productId = (int )$ product ->getId ();
129
132
$ this ->tiers ->addProductFilter ($ productId );
130
133
@@ -152,7 +155,7 @@ private function formatAndFilterTierPrices(
152
155
array $ tierPrices ,
153
156
string $ currencyCode
154
157
): array {
155
-
158
+ $ this -> resetFormatAndFilterTierPrices ();
156
159
foreach ($ tierPrices as $ key => $ tierPrice ) {
157
160
$ tierPrice ->setValue ($ this ->priceCurrency ->convertAndRound ($ tierPrice ->getValue ()));
158
161
$ this ->formatTierPrices ($ productPrice , $ currencyCode , $ tierPrice );
@@ -212,4 +215,14 @@ private function filterTierPrices(
212
215
$ this ->tierPricesQty [$ qty ] = $ key ;
213
216
}
214
217
}
218
+
219
+ /**
220
+ * Remove all element from formatAndFilterTierPrices
221
+ */
222
+ private function resetFormatAndFilterTierPrices ()
223
+ {
224
+ foreach ($ this ->formatAndFilterTierPrices as $ key => $ value ) {
225
+ unset($ this ->formatAndFilterTierPrices [$ key ]);
226
+ }
227
+ }
215
228
}
You can’t perform that action at this time.
0 commit comments