<?php $_product = $block->getProduct(); ?>
<?php $buttonTitle = __('Add to Cart'); ?>
<?php $buttonTitl = __('Get Quote'); ?>

<?php if ($_product->isSaleable()) :?>
<div class="box-tocart">
    <div class="fieldset">
        <?php if ($block->shouldRenderQuantity()) :?>
        <div class="field qty">
            <label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
            <div class="control">
                <input type="number"
                       value="<?= $block->getProductDefaultQty() * 1 ?>"
                       title="<?= $block->escapeHtmlAttr(__('Qty')) ?>"
                       class="input-text qty"
                       data-validate="<?= $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>"
        <?php endif; ?>
        <div class="actions">
            <button type="submit"
                    title="<?= $block->escapeHtmlAttr($buttonTitle) ?>"
                    class="action primary tocart"
                    id="product-addtocart-button" disabled>
                <span><?= $block->escapeHtml($buttonTitle) ?></span>
            <?= $block->getChildHtml('', true) ?>
            <button type="submit"
                    title="<?= $block->escapeHtmlAttr($buttonTitl) ?>"
                    class="action primary" 
                <span><?= $block->escapeHtml($buttonTitl) ?></span>
<a href="#" id="click-me">Get Quote</a>
<div id="popup-modal" style="display:none;">
    <form class="form" id="custom-form" method="post" autocomplete="off">
        <fieldset class="fieldset">
          <legend class="legend"><span><?php echo __('Personal Information') ?></span></legend><br>
           <div class="field required">
               <label for="email_address" class="label"><span><?php echo __('Email') ?></span></label>
                <div class="control">
                    <input type="email" name="email" id="email_address" value="" title="<?php echo __('Email') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}">
           <div class="field required">
               <label for="product_name" class="label"><span><?php echo __('Product Name') ?></span></label>
                <div class="control">
                    <input type="text" name="product_name" 
                    id="product_name" value="" title="<?php echo __('Product Name') ?>" class="input-text" disabled>

        <div class="actions-toolbar">
            <div class="primary">
                <button type="submit" class="action submit primary" title="<?php  echo __('Submit') ?>"><span><?php echo __('Submit') ?></span></button>

    ) {
        var options = {
            type: 'popup',
            responsive: true,
            innerScroll: true,
            title: 'Get Quote',
            buttons: [{
                text: $.mage.__('Continue'),
                class: '',
                click: function () {

        var popup = modal(options, $('#popup-modal'));


<?php endif; ?>
<script type="text/x-magento-init">
        "#product_addtocart_form": {
            "Magento_Catalog/js/validate-product": {}
  • what exactly you want to get?? Jun 18 at 12:22
  • this is giving blank not giving value and I need the product name to be printed in my modal form
    – kks
    Jun 18 at 12:34
  • find below my updated answer Jun 18 at 12:48


above function is loading from below file


You can use value="<?= $_product->getName(); ?>"

hope this helps you :)

  • when I am placing its value in the value attribute of product name input then its not showing anything
    – kks
    Jun 18 at 12:56
  • could you please tell me what this $_product returns?
    – kks
    Jun 18 at 13:10
  • Thank you so much. You are really a great contributor in this community.
    – kks
    Jun 18 at 13:52
  • Happy to here this words..and this works for you..$_product return all attributes of product. You can print array or log array for get all attributes value. Jun 20 at 11:56

as you already have loaded the product :

$_product = $block->getProduct();

you can use $_product to get all the product attributes



try to use echo $_product->getName(); in input value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.