https://github.com/magesuite/quote-additional-data
This module adds additional data to CustomerData. This data can be used by frontend developers to customize the mini-cart.
Installation
This module is required by theme-creativeshop
composer require "creativestyle/magesuite-quote-additional-data" ^1.0.0
Admin settings
Store->Settings->Configuration->Magesuite->Quote Additional Data
Under General
tab, isEnabled
should be set to yes
Frontend
There are new entries in quote:
discount_percentage
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 used currently in theme-creativeshop, but can be used in child projects in order to display a discount badge on minicart products.
Example code:
<!-- ko if: item.discount_percentage --> <div class="cs-minicart-product__discount"> <span class="cs-minicart-product__discount-text" data-bind="text: item.discount_percentage + '%'"></span> </div> <!-- /ko -->
row_total_product_original_price
is also available in checkout summary templates, however, theme-creativeshop does not display special price or discount badge on checkout summary items.
Code example from overridden Magento_Weee/web/template/checkout/summary/item/price/row_incl_tax.html
file:
<span data-bind="attr: {class: $parents[2].row_total_product_original_price ? 'cart-price cart-price-with-special' : 'cart-price'}"> <span class="price" data-bind="text: getFormattedPrice(getRowDisplayPriceInclTax($parents[2]))"></span> <span class="old-price" if="$parents[2].row_total_product_original_price" data-bind="html: $parents[2].row_total_product_original_price"></span> </span>
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.