I got it working! I needed to included the Magento_Tax/js/view/checkout/shipping_method/price
component (and display area) as a child of my new step module in my checkout_index_index.xml:
#app/code/Mike/Checkout/view/frontend/layout/checkout_index_index.xml
<item name="shipping-methods" xsi:type="array">
<item name="component" xsi:type="string">Mike_Checkout/js/view/shipping-methods</item>
<item name="sortOrder" xsi:type="string">1</item>
<item name="children" xsi:type="array">
<item name="price" xsi:type="array">
<item name="component" xsi:type="string">Magento_Tax/js/view/checkout/shipping_method/price</item>
<item name="displayArea" xsi:type="string">price</item>
</item>
</item>
Method 1.
When a custom enter email the following file function are called to validate the email
Magento_Checkout/web/js/view/form/element/email.js
Look the function
emailHasChanged: function () {
var self = this;
clearTimeout(this.emailCheckTimeout);
if (self.validateEmail()) {
quote.guestEmail = self.email();
checkoutData.setValidatedEmailValue(self.email());
}
this.emailCheckTimeout = setTimeout(function () {
if (self.validateEmail()) {
self.checkEmailAvailability();
} else {
self.isPasswordVisible(false);
}
}, self.checkDelay);
checkoutData.setInputFieldEmailValue(self.email());
},
Inside this function quote.guestEmail gives you the email, you can fire an ajax and save that in seesion and use.
Another option saves the email in the browser cookie
$.cookie("checkoutemail", self.email());
and retrieve the cookie value.
Method 2.
Override the following file:-
Magento\Customer\Model\AccountManagement.php
Replace the following function:-
public function isEmailAvailable($customerEmail, $websiteId = null)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$checkoutSession = $objectManager->get('\Magento\Checkout\Model\Session');
$checkoutSession->setGuestCustomerEmail($customerEmail);
try {
if ($websiteId === null) {
$websiteId = $this->storeManager->getStore()->getWebsiteId();
}
$this->customerRepository->get($customerEmail, $websiteId);
return false;
} catch (NoSuchEntityException $e) {
return true;
}
}
Use the following to retrieve the email:-
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$checkoutSession = $objectManager->get('\Magento\Checkout\Model\Session');
$guestEmail = $checkoutSession->getGuestCustomerEmail();
Follow this to override model
https://magenticians.com/override-model-magento-2/
Best Answer
Here I give example to show custom block above shipping method of checkout
<div data-bind="html: window.checkoutConfig.my_block_content"></div>
Here I add new product widget in my static block
OUTPUT: