How to add custom text block in onpage check-out The 2019 Stack Overflow Developer Survey Results Are InMagento 2 Add text in checkout page via XMLHow to check if in checkout if custom module installed?How to add a custom and dynamic block during onepage checkout?How to move Magento Coupon Block from the Cart page to the one page checkoutHow can you add a content block to magento onepage checkout?Add custom field in onepage check out,order,invoice,salesHow to add text block in magento 2 custom moduleHow to add custom content to block layout render by jslayoutHow add div after image block in Magento 2?Magento 2 : Change Comment of Onepage Checkout Email AddressMagento2 - Add Custom fields block after shipping method

Is it safe to harvest rainwater that fell on solar panels?

How can I define good in a religion that claims no moral authority?

Can an undergraduate be advised by a professor who is very far away?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

Can withdrawing asylum be illegal?

Button changing its text & action. Good or terrible?

How come people say “Would of”?

Why is this code so slow?

How can I have a shield and a way of attacking with a ranged weapon at the same time?

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Can there be female White Walkers?

Likelihood that a superbug or lethal virus could come from a landfill

Why can't wing-mounted spoilers be used to steepen approaches?

What is preventing me from simply constructing a hash that's lower than the current target?

Old scifi movie from the 50s or 60s with men in solid red uniforms who interrogate a spy from the past

What does もの mean in this sentence?

What force causes entropy to increase?

Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?

Cooking pasta in a water boiler

Loose spokes after only a few rides

Why can I use a list index as an indexing variable in a for loop?

What information about me do stores get via my credit card?

How to quickly solve partial fractions equation?



How to add custom text block in onpage check-out



The 2019 Stack Overflow Developer Survey Results Are InMagento 2 Add text in checkout page via XMLHow to check if in checkout if custom module installed?How to add a custom and dynamic block during onepage checkout?How to move Magento Coupon Block from the Cart page to the one page checkoutHow can you add a content block to magento onepage checkout?Add custom field in onepage check out,order,invoice,salesHow to add text block in magento 2 custom moduleHow to add custom content to block layout render by jslayoutHow add div after image block in Magento 2?Magento 2 : Change Comment of Onepage Checkout Email AddressMagento2 - Add Custom fields block after shipping method



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I want to add custom text block in onepage checkout in #payment page. That block will use to remind the "discount code" to customer, it's like popup text.



Please check the sample image.



enter image description here










share|improve this question
























  • explain position via screenshot and what do you mean by popup text ?

    – Hassan Ali Shahzad
    2 days ago











  • See this : magento.stackexchange.com/questions/208702/…

    – KernelPanic
    2 days ago











  • yes @ Hassan....

    – mohana
    yesterday











  • Hi @kernel, I like to display like popup text

    – mohana
    yesterday











  • Please check my updated question.

    – mohana
    yesterday

















2















I want to add custom text block in onepage checkout in #payment page. That block will use to remind the "discount code" to customer, it's like popup text.



Please check the sample image.



enter image description here










share|improve this question
























  • explain position via screenshot and what do you mean by popup text ?

    – Hassan Ali Shahzad
    2 days ago











  • See this : magento.stackexchange.com/questions/208702/…

    – KernelPanic
    2 days ago











  • yes @ Hassan....

    – mohana
    yesterday











  • Hi @kernel, I like to display like popup text

    – mohana
    yesterday











  • Please check my updated question.

    – mohana
    yesterday













2












2








2








I want to add custom text block in onepage checkout in #payment page. That block will use to remind the "discount code" to customer, it's like popup text.



Please check the sample image.



enter image description here










share|improve this question
















I want to add custom text block in onepage checkout in #payment page. That block will use to remind the "discount code" to customer, it's like popup text.



Please check the sample image.



enter image description here







magento2 onepage-checkout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







mohana

















asked 2 days ago









mohanamohana

10210




10210












  • explain position via screenshot and what do you mean by popup text ?

    – Hassan Ali Shahzad
    2 days ago











  • See this : magento.stackexchange.com/questions/208702/…

    – KernelPanic
    2 days ago











  • yes @ Hassan....

    – mohana
    yesterday











  • Hi @kernel, I like to display like popup text

    – mohana
    yesterday











  • Please check my updated question.

    – mohana
    yesterday

















  • explain position via screenshot and what do you mean by popup text ?

    – Hassan Ali Shahzad
    2 days ago











  • See this : magento.stackexchange.com/questions/208702/…

    – KernelPanic
    2 days ago











  • yes @ Hassan....

    – mohana
    yesterday











  • Hi @kernel, I like to display like popup text

    – mohana
    yesterday











  • Please check my updated question.

    – mohana
    yesterday
















explain position via screenshot and what do you mean by popup text ?

– Hassan Ali Shahzad
2 days ago





explain position via screenshot and what do you mean by popup text ?

– Hassan Ali Shahzad
2 days ago













See this : magento.stackexchange.com/questions/208702/…

– KernelPanic
2 days ago





See this : magento.stackexchange.com/questions/208702/…

– KernelPanic
2 days ago













yes @ Hassan....

– mohana
yesterday





yes @ Hassan....

– mohana
yesterday













Hi @kernel, I like to display like popup text

– mohana
yesterday





Hi @kernel, I like to display like popup text

– mohana
yesterday













Please check my updated question.

– mohana
yesterday





Please check my updated question.

– mohana
yesterday










1 Answer
1






active

oldest

votes


















3














Try following way to use magento default popup modal:




app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="beforeMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="custom_block" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/view/custom-block</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



app/code/SR/MagentoCommunity/view/frontend/web/js/view/custom-block.js




define([
'jquery',
'ko',
'uiComponent',
'Magento_Ui/js/modal/modal',
'Magento_Checkout/js/view/payment',
'mage/translate'
], function ($, ko, Component, modal, payment, $t)
'use strict';

return Component.extend(
defaults:
template: 'SR_MagentoCommunity/custom-block'
,
options:
popupModalContent: '#sr-discount-popup'
,
shouldShowMessage: ko.observable(false),
initialize: function ()
this._super();
var self = this;
var subscription = payment.prototype.isVisible.subscribe(function(value)
if (value)
var popupModalContent = self.options.popupModalContent;
var modalOption =
type: 'popup',
responsive: true,
title: 'Test Title',
buttons: [],
closed: function ()
self.shouldShowMessage(false);

;
self.shouldShowMessage(true);
$(popupModalContent).modal(modalOption);
$(popupModalContent).trigger('openModal');
subscription.dispose();

);
return this;
,
getMessage: function ()
return $t("Don't forget to use discount code");

);
);



app/code/SR/MagentoCommunity/view/frontend/web/template/custom-block.html




<div id="sr-discount-popup" data-bind="visible:shouldShowMessage">
<span data-bind="text: getMessage()"></span>
</div>





share|improve this answer























  • Thank you. @ Sohel

    – mohana
    yesterday











  • Please let me know, how to add image instead of text.

    – mohana
    yesterday






  • 1





    Pass image from php checkout config and added that image in html

    – Sohel Rana
    yesterday











  • Yeah got it thank you

    – mohana
    yesterday











  • @mohana do you manage that?

    – Sohel Rana
    yesterday











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269457%2fhow-to-add-custom-text-block-in-onpage-check-out%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














Try following way to use magento default popup modal:




app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="beforeMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="custom_block" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/view/custom-block</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



app/code/SR/MagentoCommunity/view/frontend/web/js/view/custom-block.js




define([
'jquery',
'ko',
'uiComponent',
'Magento_Ui/js/modal/modal',
'Magento_Checkout/js/view/payment',
'mage/translate'
], function ($, ko, Component, modal, payment, $t)
'use strict';

return Component.extend(
defaults:
template: 'SR_MagentoCommunity/custom-block'
,
options:
popupModalContent: '#sr-discount-popup'
,
shouldShowMessage: ko.observable(false),
initialize: function ()
this._super();
var self = this;
var subscription = payment.prototype.isVisible.subscribe(function(value)
if (value)
var popupModalContent = self.options.popupModalContent;
var modalOption =
type: 'popup',
responsive: true,
title: 'Test Title',
buttons: [],
closed: function ()
self.shouldShowMessage(false);

;
self.shouldShowMessage(true);
$(popupModalContent).modal(modalOption);
$(popupModalContent).trigger('openModal');
subscription.dispose();

);
return this;
,
getMessage: function ()
return $t("Don't forget to use discount code");

);
);



app/code/SR/MagentoCommunity/view/frontend/web/template/custom-block.html




<div id="sr-discount-popup" data-bind="visible:shouldShowMessage">
<span data-bind="text: getMessage()"></span>
</div>





share|improve this answer























  • Thank you. @ Sohel

    – mohana
    yesterday











  • Please let me know, how to add image instead of text.

    – mohana
    yesterday






  • 1





    Pass image from php checkout config and added that image in html

    – Sohel Rana
    yesterday











  • Yeah got it thank you

    – mohana
    yesterday











  • @mohana do you manage that?

    – Sohel Rana
    yesterday















3














Try following way to use magento default popup modal:




app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="beforeMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="custom_block" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/view/custom-block</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



app/code/SR/MagentoCommunity/view/frontend/web/js/view/custom-block.js




define([
'jquery',
'ko',
'uiComponent',
'Magento_Ui/js/modal/modal',
'Magento_Checkout/js/view/payment',
'mage/translate'
], function ($, ko, Component, modal, payment, $t)
'use strict';

return Component.extend(
defaults:
template: 'SR_MagentoCommunity/custom-block'
,
options:
popupModalContent: '#sr-discount-popup'
,
shouldShowMessage: ko.observable(false),
initialize: function ()
this._super();
var self = this;
var subscription = payment.prototype.isVisible.subscribe(function(value)
if (value)
var popupModalContent = self.options.popupModalContent;
var modalOption =
type: 'popup',
responsive: true,
title: 'Test Title',
buttons: [],
closed: function ()
self.shouldShowMessage(false);

;
self.shouldShowMessage(true);
$(popupModalContent).modal(modalOption);
$(popupModalContent).trigger('openModal');
subscription.dispose();

);
return this;
,
getMessage: function ()
return $t("Don't forget to use discount code");

);
);



app/code/SR/MagentoCommunity/view/frontend/web/template/custom-block.html




<div id="sr-discount-popup" data-bind="visible:shouldShowMessage">
<span data-bind="text: getMessage()"></span>
</div>





share|improve this answer























  • Thank you. @ Sohel

    – mohana
    yesterday











  • Please let me know, how to add image instead of text.

    – mohana
    yesterday






  • 1





    Pass image from php checkout config and added that image in html

    – Sohel Rana
    yesterday











  • Yeah got it thank you

    – mohana
    yesterday











  • @mohana do you manage that?

    – Sohel Rana
    yesterday













3












3








3







Try following way to use magento default popup modal:




app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="beforeMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="custom_block" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/view/custom-block</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



app/code/SR/MagentoCommunity/view/frontend/web/js/view/custom-block.js




define([
'jquery',
'ko',
'uiComponent',
'Magento_Ui/js/modal/modal',
'Magento_Checkout/js/view/payment',
'mage/translate'
], function ($, ko, Component, modal, payment, $t)
'use strict';

return Component.extend(
defaults:
template: 'SR_MagentoCommunity/custom-block'
,
options:
popupModalContent: '#sr-discount-popup'
,
shouldShowMessage: ko.observable(false),
initialize: function ()
this._super();
var self = this;
var subscription = payment.prototype.isVisible.subscribe(function(value)
if (value)
var popupModalContent = self.options.popupModalContent;
var modalOption =
type: 'popup',
responsive: true,
title: 'Test Title',
buttons: [],
closed: function ()
self.shouldShowMessage(false);

;
self.shouldShowMessage(true);
$(popupModalContent).modal(modalOption);
$(popupModalContent).trigger('openModal');
subscription.dispose();

);
return this;
,
getMessage: function ()
return $t("Don't forget to use discount code");

);
);



app/code/SR/MagentoCommunity/view/frontend/web/template/custom-block.html




<div id="sr-discount-popup" data-bind="visible:shouldShowMessage">
<span data-bind="text: getMessage()"></span>
</div>





share|improve this answer













Try following way to use magento default popup modal:




app/code/SR/MagentoCommunity/view/frontend/layout/checkout_index_index.xml




<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="checkout.root">
<arguments>
<argument name="jsLayout" xsi:type="array">
<item name="components" xsi:type="array">
<item name="checkout" xsi:type="array">
<item name="children" xsi:type="array">
<item name="steps" xsi:type="array">
<item name="children" xsi:type="array">
<item name="billing-step" xsi:type="array">
<item name="children" xsi:type="array">
<item name="payment" xsi:type="array">
<item name="children" xsi:type="array">
<item name="beforeMethods" xsi:type="array">
<item name="children" xsi:type="array">
<item name="custom_block" xsi:type="array">
<item name="component" xsi:type="string">SR_MagentoCommunity/js/view/custom-block</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>



app/code/SR/MagentoCommunity/view/frontend/web/js/view/custom-block.js




define([
'jquery',
'ko',
'uiComponent',
'Magento_Ui/js/modal/modal',
'Magento_Checkout/js/view/payment',
'mage/translate'
], function ($, ko, Component, modal, payment, $t)
'use strict';

return Component.extend(
defaults:
template: 'SR_MagentoCommunity/custom-block'
,
options:
popupModalContent: '#sr-discount-popup'
,
shouldShowMessage: ko.observable(false),
initialize: function ()
this._super();
var self = this;
var subscription = payment.prototype.isVisible.subscribe(function(value)
if (value)
var popupModalContent = self.options.popupModalContent;
var modalOption =
type: 'popup',
responsive: true,
title: 'Test Title',
buttons: [],
closed: function ()
self.shouldShowMessage(false);

;
self.shouldShowMessage(true);
$(popupModalContent).modal(modalOption);
$(popupModalContent).trigger('openModal');
subscription.dispose();

);
return this;
,
getMessage: function ()
return $t("Don't forget to use discount code");

);
);



app/code/SR/MagentoCommunity/view/frontend/web/template/custom-block.html




<div id="sr-discount-popup" data-bind="visible:shouldShowMessage">
<span data-bind="text: getMessage()"></span>
</div>






share|improve this answer












share|improve this answer



share|improve this answer










answered yesterday









Sohel RanaSohel Rana

23.2k34461




23.2k34461












  • Thank you. @ Sohel

    – mohana
    yesterday











  • Please let me know, how to add image instead of text.

    – mohana
    yesterday






  • 1





    Pass image from php checkout config and added that image in html

    – Sohel Rana
    yesterday











  • Yeah got it thank you

    – mohana
    yesterday











  • @mohana do you manage that?

    – Sohel Rana
    yesterday

















  • Thank you. @ Sohel

    – mohana
    yesterday











  • Please let me know, how to add image instead of text.

    – mohana
    yesterday






  • 1





    Pass image from php checkout config and added that image in html

    – Sohel Rana
    yesterday











  • Yeah got it thank you

    – mohana
    yesterday











  • @mohana do you manage that?

    – Sohel Rana
    yesterday
















Thank you. @ Sohel

– mohana
yesterday





Thank you. @ Sohel

– mohana
yesterday













Please let me know, how to add image instead of text.

– mohana
yesterday





Please let me know, how to add image instead of text.

– mohana
yesterday




1




1





Pass image from php checkout config and added that image in html

– Sohel Rana
yesterday





Pass image from php checkout config and added that image in html

– Sohel Rana
yesterday













Yeah got it thank you

– mohana
yesterday





Yeah got it thank you

– mohana
yesterday













@mohana do you manage that?

– Sohel Rana
yesterday





@mohana do you manage that?

– Sohel Rana
yesterday

















draft saved

draft discarded
















































Thanks for contributing an answer to Magento Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269457%2fhow-to-add-custom-text-block-in-onpage-check-out%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







-magento2, onepage-checkout

Popular posts from this blog

Creating 100m^2 grid automatically using QGIS?Creating grid constrained within polygon in QGIS?Createing polygon layer from point data using QGIS?Creating vector grid using QGIS?Creating grid polygons from coordinates using R or PythonCreating grid from spatio temporal point data?Creating fields in attributes table using other layers using QGISCreate .shp vector grid in QGISQGIS Creating 4km point grid within polygonsCreate a vector grid over a raster layerVector Grid Creates just one grid

Nikolai Prilezhaev Bibliography References External links Navigation menuEarly Russian Organic Chemists and Their Legacy092774english translationRussian Biography

How to link a C library to an Assembly library on Mac with clangHow do you set, clear, and toggle a single bit?Find (and kill) process locking port 3000 on MacWho is listening on a given TCP port on Mac OS X?How to start PostgreSQL server on Mac OS X?Compile assembler in nasm on mac osHow do I install pip on macOS or OS X?AFNetworking 2.0 “_NSURLSessionTransferSizeUnknown” linking error on Mac OS X 10.8C++ code for testing the Collatz conjecture faster than hand-written assembly - why?How to link a NASM code and GCC in Mac OS X?How to run x86 .asm on macOS Sierra