hryvinskyi / magento2-customer-sign-in-checkout
Bridge of the customer sign-in suite and the checkout: the checkout page sends a customer who owes a second sign-in step to Sign-in & Security.
Package info
github.com/hryvinskyi/magento2-customer-sign-in-checkout
Type:magento2-module
pkg:composer/hryvinskyi/magento2-customer-sign-in-checkout
Requires
- php: ~8.1.0||~8.2.0||~8.3.0||~8.4.0||~8.5.0
- hryvinskyi/magento2-customer-sign-in-frontend: ^1.0
- magento/framework: *
- magento/module-checkout: *
Requires (Dev)
- magento/module-customer: *
- magento/module-quote: *
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The bridge between the customer sign-in suite and the platform's checkout. A store can require a second sign-in step from the customers of chosen groups, and the suite's storefront package sends a customer who owes one to Sign-in & Security from every page that asks the customer session to authenticate them. The checkout page does not ask, since guests check out too. This package holds that page back as well, so a customer who owes a second step sets it up before they reach the checkout. It adds no page, setting or table.
What it does for a store
- The checkout page sends a customer who owes a second step to Sign-in & Security. A signed-in customer whom the store requires a second step from, and who has none yet, is redirected from the checkout page to Sign-in & Security (
customersignin/security), where the page tells them why. The checkout page does not run: the quote is not bound to the customer, the checkout session is not reset, and the page is not built. - Everything else opens. The cart page, a guest at the checkout, a signed-in customer who has a second step, and a customer whose group the requirement does not cover all go on as the platform does it. So does a session that an exemption added to the storefront package's gate lets through, such as an administrator signed in as the customer with
hryvinskyi/magento2-customer-sign-in-login-as-customerinstalled.
Who owes a second step, and the settings that decide it, are described in the README of hryvinskyi/magento2-customer-sign-in.
Requirements
- Magento Open Source or Adobe Commerce 2.4.x. The suite is built and tested on 2.4.9.
- PHP 8.1 to 8.5.
hryvinskyi/magento2-customer-sign-in-frontend^1.0, which brings the sign-in engine and its contracts, and the platform's Checkout module.
Installation
Run from the Magento root. hryvinskyi/magento2-customer-sign-in-pack installs this package with the rest of the suite.
composer require hryvinskyi/magento2-customer-sign-in-checkout
bin/magento module:enable Hryvinskyi_Clock Hryvinskyi_RateLimit Hryvinskyi_VerificationCode Hryvinskyi_CustomerSignInApi Hryvinskyi_CustomerSignIn Hryvinskyi_CustomerSignInFrontend Hryvinskyi_CustomerSignInCheckout
bin/magento setup:upgrade
bin/magento setup:di:compile # production mode only
bin/magento cache:flush
Verify: bin/magento module:status Hryvinskyi_CustomerSignInCheckout prints Hryvinskyi_CustomerSignInCheckout : Module is enabled.
Configuration
None of its own. It has an effect only while Require a Second Step is Yes for the website and the customer's group is chosen in Customer Groups That Need a Second Step: Stores > Settings > Configuration > Customers > Sign-in Methods > General (customer_sign_in/general/require_second_step, customer_sign_in/general/require_second_step_groups).
Stored data
None.
Limits
- The checkout page only. The package holds back the one-page checkout page. An order placed without opening that page is not stopped: an express payment button that starts a payment provider's own review flow, one-click purchase on the product page, and a web API call the storefront makes with the customer's session.
Registrations
| Where | What |
|---|---|
Plugin around on Magento\Checkout\Controller\Index\Index::execute (frontend) |
Plugin\Checkout\SendOwedSecondStepToSetUp redirects to Hryvinskyi\CustomerSignInFrontend\Model\SecondStepSetUpGateInterface::setUpUrl() without running the page when the gate's mustSetUpFirst() is true. |
The package registers no route, table, setting, ACL resource, cron job or command.
Versioning
The package follows Semantic Versioning. What changed in each version is in CHANGELOG.md.
Tests
Run from the Magento root.
- Integration: the platform's harness in
dev/tests/integration, one run at a time against its own database.cd dev/tests/integration && php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml ../../../app/code/Hryvinskyi/CustomerSignInCheckout/Test/Integration. The tests use the test fixtures ofhryvinskyi/magento2-customer-sign-in-frontend, and also need the platform's Customer and Quote modules. - Static analysis: PHPStan 2.x at level 10 with the package's
phpstan.neon.dist(phpstan analyse -c app/code/Hryvinskyi/CustomerSignInCheckout/phpstan.neon.dist --level=10), andvendor/bin/phpcs --standard=app/code/Hryvinskyi/CustomerSignInCheckout/phpcs.xml.dist app/code/Hryvinskyi/CustomerSignInCheckout.