QuoteAdditionalData
https://github.com/magesuite/quote-additional-data
This module adds additional data to customerData. Frontend developers can use this data to customize the mini-cart.
Installation
This module is required by theme-creativeshop and is installed out of the box when theme-creativeshop is required
composer require "creativestyle/magesuite-quote-additional-data" ^1.0.0
Admin settings
Stores > Configuration > MageSuite > Quote Additional Data
Under the General
tab, Is Enabled
should be set to yes
Backend
It can be easily extended by implementing one of these interfaces:
MageSuite\QuoteAdditionalData\Api\QuoteAdditionalDataProcessorInterface
MageSuite\QuoteAdditionalData\Api\QuoteItemAdditionalDataProcessorInterface
Then processor needs to be added to the list in di.xml
file in the customization module:
<type name="MageSuite\QuoteAdditionalData\Plugin\Checkout\CustomerData\AbstractItem\AddAdditionalDataToQuoteItem">
<arguments>
<argument name="additionalDataProcessors" xsi:type="array">
<item name="productOriginalPrice" xsi:type="object">MageSuite\QuoteAdditionalData\Model\Checkout\CustomerData\QuoteItemAdditionalDataProcessor\ProductOriginalPrice</item>
</argument>
</arguments>
</type>
<type name="MageSuite\QuoteAdditionalData\Plugin\Checkout\CustomerData\Cart\AddAdditionalDataToQuote">
<arguments>
<argument name="additionalDataProcessors" xsi:type="array">
<item name="rowTotalProductPrice" xsi:type="object">MageSuite\QuoteAdditionalData\Model\Checkout\CustomerData\QuoteAdditionalDataProcessor\RowTotalProductPrice</item>
<item name="discountPercentage" xsi:type="object">MageSuite\QuoteAdditionalData\Model\Checkout\CustomerData\QuoteAdditionalDataProcessor\DiscountPercentage</item>
</argument>
</arguments>
</type>
By default, all processors are enabled but there is a possibility to disable a specific processor:
<type name="MageSuite\QuoteAdditionalData\Model\Checkout\CustomerData\QuoteAdditionalDataProcessor\DiscountPercentage">
<arguments>
<argument name="isEnabled" xsi:type="boolean">false</argument>
</arguments>
</type>
Frontend
There are new entries in CustomerData:
discount_percentage
product_original_price
row_total_product_original_price
They are used in https://github.com/magesuite/theme-creativeshop/blob/next/src/Magento_Checkout/web/template/minicart/item/default.html HTML template.
If Additional quote data is enabled and data is present, there is a special price displayed in minicart. discount_percentage
is not currently used in theme-creativeshop, but can be used in child projects to display a discount badge on minicart products.
Example code:
row_total_product_original_price
is also available in checkout summary templates, however, theme-creativeshop does not display special prices or discount badge on checkout summary items.
Code example from overridden: Magento_Weee/web/template/checkout/summary/item/price/row_incl_tax.html
file:
Styling
Styling of special price is included in theme-creativeshop/src/components/minicart-product/minicart-product.scss
file
$minicart-product_show-special-price
variable should be set to yes in order to include styles.