...
Free shipping
rule is set as a cart bonus with a hidden label. The label is visible when a user passes the threshold.
...
Backend
Template
app/design/frontend/creativestyle/theme-creativeshop/MageSuite_CartBonus/templates/status.phtml
...
Code Block |
---|
class Status { public function getAwardedBonusesCount() { $awardedBonuses = 0; foreach($this->bonuses as $bonus) { if(!$bonus->wasAwarded()) { continue; } $awardedBonuses++; } return $awardedBonuses; } } |
Plugin
vendor/creativestyle/magesuite-shipping-addons/Plugin/Checkout/Block/Cart/Totals/AddFreeShippingBarVariables.php:40
Code Block |
---|
class AddFreeShippingBarVariables
{
public function afterGetJsLayout(\Magento\Checkout\Block\Cart\Totals $subject, $jsLayout)
{
.....
if (!empty($freeShippingBarConfig)) {
$freeShippingBarConfig['freeShippingFrom'] = $this->shippingMethodsHelper->getMinimumFreeShippingAmount();
$freeShippingBarConfig['priceFormat'] = $this->taxHelper->getPriceFormat($this->storeManager->getStore()->getId());
$jsLayout = $this->arrayManager->set(self::FREE_SHIPPING_BAR_CONFIG_PATH, $jsLayout, $freeShippingBarConfig);
}
return json_encode($jsLayout);
}
} |
Frontend
Each bonus is displayed as a section of a bar. After cart page is loaded the progress bar is animated.
...