Search by

mageenv / module-total-savings-hyva

mageenvm2

Hyva storefront integration for MageEnv Total Savings - an Alpine.js Cart Page savings card consuming the shared savings payload. No business logic.

Package info

github.com/mageenvm2/module-total-savings-hyva

Homepage

Type:magento2-module

pkg:composer/mageenv/module-total-savings-hyva

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.2.0 2026-10-30 13:32 UTC

This package is auto-updated.

Last update: 2026-10-30 13:46:53 UTC


README

Composer package: mageenv/module-total-savings-hyva Magento module: MageEnv_TotalSavingsHyva Version: 1.2.0

Product page, screenshots and user guide: mageenv.com/extensions/total-savings

Purpose

Hyvä storefront rendering for MageEnv Total Savings. It provides an Alpine.js Cart Page savings card for Hyvä themes, the same card as the Luma component in the core module (savings amount, % OFF badge, Regular → You pay comparison, savings breakdown), rendered with Alpine instead of Knockout.

This module contains no business logic. Its only PHP is registration.php and one thin ViewModel (ViewModel\HyvaContext, which answers "is the active theme a Hyvä theme?"); a unit test enforces this. Savings calculation, currency formatting, the title text and the storefront payload all live in MageEnv_TotalSavings. This module renders that payload with Alpine.js and keeps it current from the same mageenv-totalsavings customer-data section (via Hyvä's private-content-loaded flow).

Relationship to the core module

Business core (required) mageenv/module-total-savings ^1.2.0
This module Hyvä-only presentation layer for that core

Install this module in addition to the core module on any installation with a Hyvä store view. A Luma-only store needs the core module alone.

It cannot affect a Luma store view:

  • the layout file is hyva_checkout_cart_index.xml, a hyva_ handle that Hyva_Theme activates only when the running theme is a Hyvä theme, so on Luma its stylesheet and blocks are never merged;
  • every CSS selector is scoped under .mageenv-totalsavings--hyva, a class only the Hyvä template adds;
  • the template renders nothing when HyvaContext::isHyvaTheme() is false.

Requirements

Supported
Magento Open Source 2.4.7 – 2.4.9
PHP 8.2, 8.3, 8.4, 8.5
mageenv/module-total-savings ^1.2.0
hyva-themes/magento2-theme-module >=1.1.0 <2

Verified in the Hyvä default theme (theme module 1.5.2) on Magento 2.4.9 / PHP 8.3: Cart page on desktop and mobile, all three Cart Page Placement options, breakdown toggle, quantity change, coupon apply, empty cart, and Luma isolation in a mixed Luma + Hyvä installation.

The card uses the standard Alpine.js build that Hyvä ships by default. Hyvä's optional Alpine CSP build (strict CSP without unsafe-eval) is not supported yet.

Installation

Buy and install the core module first: it comes from the Adobe Commerce Marketplace through repo.magento.com, using the access keys of the account that bought it. Then add this free package:

composer require mageenv/module-total-savings-hyva
bin/magento module:enable MageEnv_TotalSavings MageEnv_TotalSavingsHyva
bin/magento setup:upgrade
bin/magento setup:di:compile      # production mode only
bin/magento setup:static-content:deploy   # production mode only
bin/magento cache:flush

How it integrates

  • view/frontend/layout/hyva_checkout_cart_index.xml declares one Alpine block per Cart Page Placement option (Stores > Configuration > MageEnv > Total Savings): mageenv.totalsavings.cart.hyva.summary (top of the Order Summary, default), mageenv.totalsavings.cart.hyva.summary_bottom (under the "Proceed to Checkout" button) and mageenv.totalsavings.cart.hyva.above (above the item list). Only the configured one renders. No cart template is overridden.
  • The template server-renders the initial payload (HTML-attribute escaped) into x-data, then updates it from the mageenv-totalsavings section on private-content-loaded. The Alpine factory is an external, CSP-safe script, never inline.
  • Styles are scoped, theme-neutral and px-sized to match the Luma card; no Tailwind utilities and no calculation on the client.

Checkout

This package adds nothing to checkout. The Hyvä default theme renders checkout with the standard Magento (Luma) checkout through Hyvä's Luma checkout fallback, and the core module's checkout card works there unchanged. Hyvä Checkout (Hyvä's separate checkout product) is not supported yet.

Testing

vendor/bin/phpunit -c app/code/MageEnv/TotalSavingsHyva/Test/Unit/phpunit.xml.dist
vendor/bin/phpcs --standard=app/code/MageEnv/TotalSavingsHyva/phpcs.xml.dist \
  app/code/MageEnv/TotalSavingsHyva

Changelog

See CHANGELOG.md.

License

Open Software License 3.0 (OSL-3.0). See LICENSE.txt.

This add-on is free. It needs the paid core module mageenv/module-total-savings, available on the Adobe Commerce Marketplace.