Yireo_HyvaWithoutGraphQl

PHP 8.1 - 8.4
Magento 2.4.7 | 2.4.8
CSP Yes
PHPStan 5
Magento PHPCS 6

Magento version PHP version License Latest Version

Replaces the GraphQL calls of various Hyvä templates with regular Magento controllers.

What it does

A few Hyvä templates fetch their data from the GraphQL endpoint. This module replaces those calls with regular Magento frontend controllers, so that the storefront no longer depends on the GraphQL API for these features.

| Hyvä template | Alpine component | Method | How | |---|---|---|---| | Magento_Review::customer/list.phtml | initReviewList | getReviewsList | JS proxy | | Magento_Catalog::product/widget/viewed/js/recently-viewed-products.phtml | initRecentlyViewedProductsComponent | fetchProducts | JS proxy | | Magento_Review::form.phtml | initReviewForm | placeReview | JS proxy | | Magento_Theme::elements/slider.phtml | initSliderComponent<uniqid> | getProducts | template replacement |

The first three are left intact: an extra template is rendered right after the original one, which wraps the global component factory and swaps out that single method. The deprecated GraphQL product slider is replaced entirely, because its query is built from block arguments that only exist server side.

Both are done from a single plugin on Magento\Framework\View\TemplateEngine\Php, so widgets and dynamically named blocks are covered as well. The template maps are DI arguments of Yireo\HyvaWithoutGraphQl\Plugin\TemplateEngine\SwapGraphQlTemplates, so individual entries can be removed in a project.

The controllers answer with exactly the same data structure as the GraphQL responses they replace, which is why the Hyvä templates keep rendering unchanged.

| Route | Method | Replaces | |---|---|---| | hyva-without-graphql/reviews/customer | GET | customer.reviews | | hyva-without-graphql/reviews/save | POST | createProductReview | | hyva-without-graphql/products/skus | GET | products(filter: {sku: {in: []}}) | | hyva-without-graphql/products/slider | GET | the slider products query |

Installation

Install this package via composer (provided you have properly configured our composer API first):

composer require yireo/magento2-hyva-without-graph-ql

Next, enable this module:

bin/magento module:enable Yireo_HyvaWithoutGraphQl
bin/magento setup:upgrade

Configuration

Stores > Configuration > General > Hyvä Without GraphQL > Settings > Enabled (yireo_hyva_without_graph_ql/settings/enabled, default 1). When switched off, the templates are left untouched and the controllers answer with a 404.

Security

  • reviews/save validates the Magento form key itself and answers with JSON instead of a redirect, and validates reCAPTCHA for form id product_review when it is configured.
  • reviews/customer only ever returns the reviews of the customer in the current session.
  • The slider parameters travel over the URL. The page size is capped at 100 and the sort attribute is limited to a whitelist.
  • All responses are sent with Cache-Control: no-store, since they depend on store, currency, customer group or customer session.

Notes and limitations

  • A slider block that is configured with a custom graphql_query argument is no longer honoured. The structured arguments (product_skus, category_ids, price_from, price_to, page_size, sort_attribute, sort_direction, type) and product_filters are supported. product_filters is parsed by Yireo\HyvaWithoutGraphQl\Model\ProductFilterParser, which understands eq, neq, in, nin, from, to, gt, gteq, lt, lteq, like and match. Anything else is ignored and logged.
  • The recently viewed proxy only comes into play when catalog/recently_products/synchronize_with_backend is enabled. Without it, Hyvä renders the widget straight from browser storage and never calls GraphQL in the first place.
  • The customer review list no longer waits for the GraphQL signin_token of the private content section; the session cookie is enough for a regular controller.
  • price_range.minimum_price.base_price stays absent, matching the original GraphQL query.
  • The replacement slider template fixes two typos of the original: getprevButtonClasses (now getPrevButtonClasses) and fillerSlideNumer (now fillerSlideNumber). It also uses x-text instead of x-html for the product name.

Current status

Static Tests Unit Tests Integration Tests Playwright DI Compilation

WARNING: This module has no releases yet. If you want to use it, make sure to add the version @dev to the composer command.

Support

For getting support, create an Issue under the following project URL:

https://gitlab.yireo.com/loki-checkout/Yireo_HyvaWithoutGraphQl.git

Composer details
Magento module name
Yireo_HyvaWithoutGraphQl
Composer name
yireo/magento2-hyva-without-graph-ql
Composer version
No release yet
Default branch
main
Requirements
php: ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0
magento/framework: *
magento/module-catalog: *
magento/module-config: *
magento/module-customer: *
magento/module-review: *
magento/module-store: *
magento/module-theme: *
Releases
Changelog

Added

  • Plugin SwapGraphQlTemplates on Magento\Framework\View\TemplateEngine\Php that replaces or extends Hyvä templates containing a GraphQL call.
  • JS proxies for initReviewList::getReviewsList, initReviewForm::placeReview and initRecentlyViewedProductsComponent::fetchProducts.
  • GraphQL-free replacement of Magento_Theme::elements/slider.phtml.
  • Frontend controllers hyva-without-graphql/reviews/customer, hyva-without-graphql/reviews/save, hyva-without-graphql/products/skus and hyva-without-graphql/products/slider.
  • Store configuration yireo_hyva_without_graph_ql/settings/enabled to switch the module off per store.
  • Unit tests for the filter parser, the request normalizer and the template plugin, plus integration tests for the four controllers.

Changed

  • Added php and magento/module-theme requirements to composer.json.
  • Synchronised MODULE.json sequence with etc/module.xml and enabled PHPStan level 5 and PHPCS severity 6 in CI.
  • Made the GraphQL marker detection in SwapGraphQlTemplates case-insensitive.
  • Documented the CSRF bypass in Reviews\Save and clarified CustomerReviewProvider PHPDoc.

Last modified: September 7, 2026