I created a custom module to show suggested addresses when customer type in the address fill. However, the requirejs load before the content of checkout page load, even though I have put "domReady!".
How can I make the script to load after everything is loaded.
checkout.phtml
<?php
$client_id = $block->getClientID();
$client_secret = $block->getClientSecret();
?>
<?php if ($block->isEnabled()): ?>
<script type="text/x-magento-init" order="100">
{
"*": {
"addressfinder": {
"client_id": "<?php echo $client_id; ?>"
}
}
}
</script>
<?php endif ?>
addressfinder.js
define([
'jquery',
'domReady!',
'./checkout_mapping'], function($, domReady, data) {
"use strict";
return function(config) {
//my code
}
});