@@ -231,6 +231,65 @@ protected function getPrice(Product $product): float
231231 return $ this ->formatPrice ($ price );
232232 }
233233
234+ /**
235+ * @param $product
236+ * @return float
237+ */
238+ protected function getProductValue ($ product ): float
239+ {
240+ $ value = $ this ->getPrice ($ product );
241+
242+ if (!$ this ->config ->isPurchaseTaxEnabled ()) {
243+ $ value = $ product ->getPriceInfo ()->getPrice ('final_price ' )->getAmount ()->getValue ('tax ' );
244+ }
245+
246+ return $ this ->formatPrice ($ value );
247+ }
248+
249+ /**
250+ * @param $quote
251+ * @return float
252+ */
253+ protected function getQuoteValue ($ quote ): float
254+ {
255+ $ quoteValue = (float )$ quote ->getGrandTotal ();
256+ $ address = $ quote ->getShippingAddress () ?: $ quote ->getBillingAddress ();
257+
258+ if (!$ this ->config ->isPurchaseTaxEnabled ()) {
259+ $ quoteValue -= (float )$ address ->getTaxAmount ();
260+ }
261+
262+ if (!$ this ->config ->isPurchaseShippingEnabled ()) {
263+ $ quoteValue -= (float )$ address ->getShippingAmount ();
264+ }
265+
266+ return $ this ->formatPrice ($ quoteValue );
267+ }
268+
269+ /**
270+ * @param $quoteItem
271+ * @return float
272+ */
273+ protected function getQuoteItemValue ($ quoteItem ): float
274+ {
275+ //fix for magento 2.3.2 - module-quote/Model/Quote/Item/Processor.php prepareItem does not set price to quote item
276+ $ quoteItemValue = $ quoteItem ->getPriceInclTax ();
277+ if (!$ quoteItemValue && ($ quoteItemProduct = $ quoteItem ->getProduct ())) {
278+ $ quoteItemValue = (float )$ quoteItemProduct ->getPrice ();
279+ }
280+
281+ if (!$ this ->config ->isPurchaseTaxEnabled ()) {
282+ $ quoteItemValue -= (float )$ quoteItem ->getTaxAmount ();
283+ }
284+
285+ if (!$ this ->config ->isPurchaseTaxEnabled ()) {
286+ $ quoteItemValue -= (float )$ quoteItem ->getAddress ()->getShippingAmount ();
287+ }
288+
289+ return $ this ->formatPrice ($ quoteItemValue );
290+ }
291+
292+
234293 /**
235294 * @param Product $product
236295 * @param string $attributeCode
0 commit comments