@@ -51,30 +51,39 @@ public function resolve(
51
51
if (!isset ($ value ['model ' ])) {
52
52
throw new LocalizedException (__ ('"model" value should be specified ' ));
53
53
}
54
+
54
55
$ fptArray = [];
55
56
$ product = $ value ['model ' ];
56
57
57
58
/** @var StoreInterface $store */
58
59
$ store = $ context ->getExtensionAttributes ()->getStore ();
59
60
60
- $ attributes = $ this ->weeeHelper ->getProductWeeeAttributesForDisplay ($ product );
61
- foreach ($ attributes as $ attribute ) {
62
- $ displayInclTaxes = $ this ->taxHelper ->getPriceDisplayType ($ store );
63
- $ amount = $ attribute ->getData ('amount ' );
64
- if ($ displayInclTaxes === 1 ) {
65
- $ amount = $ attribute ->getData ('amount_excl_tax ' );
66
- } elseif ($ displayInclTaxes === 2 ) {
67
- $ amount = $ attribute ->getData ('amount_excl_tax ' ) + $ attribute ->getData ('tax_amount ' );
68
- }
69
- $ fptArray [] = [
70
- 'amount ' => [
71
- 'value ' => $ amount ,
72
- 'currency ' => $ value ['final_price ' ]['currency ' ],
61
+
62
+ if (!$ this ->weeeHelper ->isEnabled ($ store )) {
63
+ return $ fptArray ;
64
+ }
65
+
66
+
67
+ if ($ this ->weeeHelper ->isDisplayInclDesc ($ store ) || $ this ->weeeHelper ->isDisplayExclDescIncl ($ store )) {
68
+ $ attributes = $ this ->weeeHelper ->getProductWeeeAttributesForDisplay ($ product );
69
+ foreach ($ attributes as $ attribute ) {
70
+ $ displayInclTaxes = $ this ->taxHelper ->getPriceDisplayType ($ store );
71
+ $ amount = $ attribute ->getData ('amount ' );
72
+ //add display mode for WEE to not return WEE if excluded
73
+ if ($ displayInclTaxes === 1 ) {
74
+ $ amount = $ attribute ->getData ('amount_excl_tax ' );
75
+ } elseif ($ displayInclTaxes === 2 ) {
76
+ $ amount = $ attribute ->getData ('amount_excl_tax ' ) + $ attribute ->getData ('tax_amount ' );
77
+ }
78
+ $ fptArray [] = [
79
+ 'amount ' => [
80
+ 'value ' => $ amount ,
81
+ 'currency ' => $ value ['final_price ' ]['currency ' ],
73
82
],
74
83
'label ' => $ attribute ->getData ('name ' )
75
- ];
84
+ ];
85
+ }
76
86
}
77
-
78
87
return $ fptArray ;
79
88
}
80
89
}
0 commit comments