Magento2: How to add a text between swatch configure and swatch attribute name?How to configure Profiler in Magento 2?Create Visual Swatch AttributeMagento2 Custom EAV attribute text in layered navigationMagneto2 : Add color swatch attribute option with colorcode value programmaticallyMagento 2 Free Input Text Field AttributeMagento 2 - Setting “Text Swatch” or “Visual Swatch” does not work. Attribute still shows as dropdown on frontendMagento2 how to associate attribute options to exist attribute?magento 2 cannot add text swatch option via php codeHow to add custom text to all email templates?How can I have a product attribute with a source model as a swatch?

If your plane is out-of-control, why does military training instruct releasing the joystick to neutralize controls?

Why does this potentiometer in an op-amp feedback path cause noise when adjusted?

How were Martello towers supposed to work?

Sharing shapefile collection

How can a dictatorship government be beneficial to a dictator in a post-scarcity society?

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

Convert BAM to properly paired FASTQ files

Do I have a right to cancel a purchase of foreign currency in the UK?

Misspelling my name on my mathematical publications

Should disabled buttons give feedback when clicked?

Historical experience as a guide to warship design?

How can I truly shut down ssh server?

How do we handle pauses in a dialogue?

Why isn't pressure filtration popular compared to vacuum filtration?

Why do we need common sense in AI?

What happens to unproductive professors?

How to befriend private nested class

Confirming the Identity of a (Friendly) Reviewer After the Reviews

Plotting a function defined by equation without closed form solution

Is there any word for "disobedience to God"?

What does the phrase "head down the rat's hole" mean here?

Does the Pole of Angling's command word require an action?

How will law be enforced if violence becomes impossible?

How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?



Magento2: How to add a text between swatch configure and swatch attribute name?


How to configure Profiler in Magento 2?Create Visual Swatch AttributeMagento2 Custom EAV attribute text in layered navigationMagneto2 : Add color swatch attribute option with colorcode value programmaticallyMagento 2 Free Input Text Field AttributeMagento 2 - Setting “Text Swatch” or “Visual Swatch” does not work. Attribute still shows as dropdown on frontendMagento2 how to associate attribute options to exist attribute?magento 2 cannot add text swatch option via php codeHow to add custom text to all email templates?How can I have a product attribute with a source model as a swatch?






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








2















I am having trouble while creating a module that add a text between swatch configure and swatch attribute name load by default, I want to add it only on a specific swatch if I have more than one. And what if it an input. How Can I do that?

For exmaple: we have
[attribute name] [attribute configure]

I want to add a text between them

[attribute name] [text] [attribute configure]
How can I do this, thanks
enter image description here










share|improve this question
























  • Do you want to load it by default OR on On click swatches? And also please add screen here what exactly you expect?

    – Ravi Soni
    Jul 2 at 6:38












  • I want to load it by default, but really do not know how to do it

    – sekiro
    Jul 2 at 6:39












  • Can you please add screenshot what do you want OR on which page?

    – Ravi Soni
    Jul 2 at 6:55











  • @RaviSoni I just add it, thanks

    – sekiro
    Jul 2 at 7:02

















2















I am having trouble while creating a module that add a text between swatch configure and swatch attribute name load by default, I want to add it only on a specific swatch if I have more than one. And what if it an input. How Can I do that?

For exmaple: we have
[attribute name] [attribute configure]

I want to add a text between them

[attribute name] [text] [attribute configure]
How can I do this, thanks
enter image description here










share|improve this question
























  • Do you want to load it by default OR on On click swatches? And also please add screen here what exactly you expect?

    – Ravi Soni
    Jul 2 at 6:38












  • I want to load it by default, but really do not know how to do it

    – sekiro
    Jul 2 at 6:39












  • Can you please add screenshot what do you want OR on which page?

    – Ravi Soni
    Jul 2 at 6:55











  • @RaviSoni I just add it, thanks

    – sekiro
    Jul 2 at 7:02













2












2








2








I am having trouble while creating a module that add a text between swatch configure and swatch attribute name load by default, I want to add it only on a specific swatch if I have more than one. And what if it an input. How Can I do that?

For exmaple: we have
[attribute name] [attribute configure]

I want to add a text between them

[attribute name] [text] [attribute configure]
How can I do this, thanks
enter image description here










share|improve this question
















I am having trouble while creating a module that add a text between swatch configure and swatch attribute name load by default, I want to add it only on a specific swatch if I have more than one. And what if it an input. How Can I do that?

For exmaple: we have
[attribute name] [attribute configure]

I want to add a text between them

[attribute name] [text] [attribute configure]
How can I do this, thanks
enter image description here







magento2 magento2.3 swatches






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 2 at 9:11









Ravi Varma

3351 silver badge13 bronze badges




3351 silver badge13 bronze badges










asked Jul 2 at 6:33









sekirosekiro

135 bronze badges




135 bronze badges












  • Do you want to load it by default OR on On click swatches? And also please add screen here what exactly you expect?

    – Ravi Soni
    Jul 2 at 6:38












  • I want to load it by default, but really do not know how to do it

    – sekiro
    Jul 2 at 6:39












  • Can you please add screenshot what do you want OR on which page?

    – Ravi Soni
    Jul 2 at 6:55











  • @RaviSoni I just add it, thanks

    – sekiro
    Jul 2 at 7:02

















  • Do you want to load it by default OR on On click swatches? And also please add screen here what exactly you expect?

    – Ravi Soni
    Jul 2 at 6:38












  • I want to load it by default, but really do not know how to do it

    – sekiro
    Jul 2 at 6:39












  • Can you please add screenshot what do you want OR on which page?

    – Ravi Soni
    Jul 2 at 6:55











  • @RaviSoni I just add it, thanks

    – sekiro
    Jul 2 at 7:02
















Do you want to load it by default OR on On click swatches? And also please add screen here what exactly you expect?

– Ravi Soni
Jul 2 at 6:38






Do you want to load it by default OR on On click swatches? And also please add screen here what exactly you expect?

– Ravi Soni
Jul 2 at 6:38














I want to load it by default, but really do not know how to do it

– sekiro
Jul 2 at 6:39






I want to load it by default, but really do not know how to do it

– sekiro
Jul 2 at 6:39














Can you please add screenshot what do you want OR on which page?

– Ravi Soni
Jul 2 at 6:55





Can you please add screenshot what do you want OR on which page?

– Ravi Soni
Jul 2 at 6:55













@RaviSoni I just add it, thanks

– sekiro
Jul 2 at 7:02





@RaviSoni I just add it, thanks

– sekiro
Jul 2 at 7:02










1 Answer
1






active

oldest

votes


















0














You can add below code in swatch-renderer.js



Override this file in your custom theme and add custom code in below funciton.




/vendor/magento/module-swatches/view/frontend/web/js/swatch-renderer.js




_init: function () 
if (_.isEmpty(this.options.jsonConfig.images))
this.options.useAjax = true;
// creates debounced variant of _LoadProductMedia()
// to use it in events handlers instead of _LoadProductMedia()
this._debouncedLoadProductMedia = _.debounce(this._LoadProductMedia.bind(this), 500);


if (this.options.jsonConfig !== '' && this.options.jsonSwatchConfig !== '')
// store unsorted attributes
this.options.jsonConfig.mappedAttributes = _.clone(this.options.jsonConfig.attributes);
this._sortAttributes();
this._RenderControls();
this._setPreSelectedGallery();
$(this.element).trigger('swatch.initialized');
else
console.log('SwatchRenderer: No input data received');

this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html();
if ($(".swatch-attribute.color")[0])
$('.swatch-attribute.color').after('<span>Some text</span>');

,


Here 'Some text'



Now color is your specific swatch code. "You can add your attribute code here"



Please check this.






share|improve this answer

























  • and what if in a product there are many swatches how can I choose a specific swatch attribute and add some text to it. I can understand your code however, it work with every swatch attribute, but not with an individual swatch attribute

    – sekiro
    Jul 2 at 8:00











  • Check now I have updated my code

    – Ravi Soni
    Jul 2 at 8:25











  • Oh thanks, I want to ask what is number 0 mean in this line if ($(".swatch-attribute.color")[0])

    – sekiro
    Jul 2 at 8:28











  • I add your code to my module however, it not display next to swatches attribute name it display under them

    – sekiro
    Jul 2 at 8:45











  • Oh. here I come to solution with your code. $('.swatch-attribute.color > .swatch-attribute-label').after('<span>Some text</span>') it will place next to swatches attribute name. Thanks for your help

    – sekiro
    Jul 2 at 8:51














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%2f280381%2fmagento2-how-to-add-a-text-between-swatch-configure-and-swatch-attribute-name%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









0














You can add below code in swatch-renderer.js



Override this file in your custom theme and add custom code in below funciton.




/vendor/magento/module-swatches/view/frontend/web/js/swatch-renderer.js




_init: function () 
if (_.isEmpty(this.options.jsonConfig.images))
this.options.useAjax = true;
// creates debounced variant of _LoadProductMedia()
// to use it in events handlers instead of _LoadProductMedia()
this._debouncedLoadProductMedia = _.debounce(this._LoadProductMedia.bind(this), 500);


if (this.options.jsonConfig !== '' && this.options.jsonSwatchConfig !== '')
// store unsorted attributes
this.options.jsonConfig.mappedAttributes = _.clone(this.options.jsonConfig.attributes);
this._sortAttributes();
this._RenderControls();
this._setPreSelectedGallery();
$(this.element).trigger('swatch.initialized');
else
console.log('SwatchRenderer: No input data received');

this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html();
if ($(".swatch-attribute.color")[0])
$('.swatch-attribute.color').after('<span>Some text</span>');

,


Here 'Some text'



Now color is your specific swatch code. "You can add your attribute code here"



Please check this.






share|improve this answer

























  • and what if in a product there are many swatches how can I choose a specific swatch attribute and add some text to it. I can understand your code however, it work with every swatch attribute, but not with an individual swatch attribute

    – sekiro
    Jul 2 at 8:00











  • Check now I have updated my code

    – Ravi Soni
    Jul 2 at 8:25











  • Oh thanks, I want to ask what is number 0 mean in this line if ($(".swatch-attribute.color")[0])

    – sekiro
    Jul 2 at 8:28











  • I add your code to my module however, it not display next to swatches attribute name it display under them

    – sekiro
    Jul 2 at 8:45











  • Oh. here I come to solution with your code. $('.swatch-attribute.color > .swatch-attribute-label').after('<span>Some text</span>') it will place next to swatches attribute name. Thanks for your help

    – sekiro
    Jul 2 at 8:51
















0














You can add below code in swatch-renderer.js



Override this file in your custom theme and add custom code in below funciton.




/vendor/magento/module-swatches/view/frontend/web/js/swatch-renderer.js




_init: function () 
if (_.isEmpty(this.options.jsonConfig.images))
this.options.useAjax = true;
// creates debounced variant of _LoadProductMedia()
// to use it in events handlers instead of _LoadProductMedia()
this._debouncedLoadProductMedia = _.debounce(this._LoadProductMedia.bind(this), 500);


if (this.options.jsonConfig !== '' && this.options.jsonSwatchConfig !== '')
// store unsorted attributes
this.options.jsonConfig.mappedAttributes = _.clone(this.options.jsonConfig.attributes);
this._sortAttributes();
this._RenderControls();
this._setPreSelectedGallery();
$(this.element).trigger('swatch.initialized');
else
console.log('SwatchRenderer: No input data received');

this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html();
if ($(".swatch-attribute.color")[0])
$('.swatch-attribute.color').after('<span>Some text</span>');

,


Here 'Some text'



Now color is your specific swatch code. "You can add your attribute code here"



Please check this.






share|improve this answer

























  • and what if in a product there are many swatches how can I choose a specific swatch attribute and add some text to it. I can understand your code however, it work with every swatch attribute, but not with an individual swatch attribute

    – sekiro
    Jul 2 at 8:00











  • Check now I have updated my code

    – Ravi Soni
    Jul 2 at 8:25











  • Oh thanks, I want to ask what is number 0 mean in this line if ($(".swatch-attribute.color")[0])

    – sekiro
    Jul 2 at 8:28











  • I add your code to my module however, it not display next to swatches attribute name it display under them

    – sekiro
    Jul 2 at 8:45











  • Oh. here I come to solution with your code. $('.swatch-attribute.color > .swatch-attribute-label').after('<span>Some text</span>') it will place next to swatches attribute name. Thanks for your help

    – sekiro
    Jul 2 at 8:51














0












0








0







You can add below code in swatch-renderer.js



Override this file in your custom theme and add custom code in below funciton.




/vendor/magento/module-swatches/view/frontend/web/js/swatch-renderer.js




_init: function () 
if (_.isEmpty(this.options.jsonConfig.images))
this.options.useAjax = true;
// creates debounced variant of _LoadProductMedia()
// to use it in events handlers instead of _LoadProductMedia()
this._debouncedLoadProductMedia = _.debounce(this._LoadProductMedia.bind(this), 500);


if (this.options.jsonConfig !== '' && this.options.jsonSwatchConfig !== '')
// store unsorted attributes
this.options.jsonConfig.mappedAttributes = _.clone(this.options.jsonConfig.attributes);
this._sortAttributes();
this._RenderControls();
this._setPreSelectedGallery();
$(this.element).trigger('swatch.initialized');
else
console.log('SwatchRenderer: No input data received');

this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html();
if ($(".swatch-attribute.color")[0])
$('.swatch-attribute.color').after('<span>Some text</span>');

,


Here 'Some text'



Now color is your specific swatch code. "You can add your attribute code here"



Please check this.






share|improve this answer















You can add below code in swatch-renderer.js



Override this file in your custom theme and add custom code in below funciton.




/vendor/magento/module-swatches/view/frontend/web/js/swatch-renderer.js




_init: function () 
if (_.isEmpty(this.options.jsonConfig.images))
this.options.useAjax = true;
// creates debounced variant of _LoadProductMedia()
// to use it in events handlers instead of _LoadProductMedia()
this._debouncedLoadProductMedia = _.debounce(this._LoadProductMedia.bind(this), 500);


if (this.options.jsonConfig !== '' && this.options.jsonSwatchConfig !== '')
// store unsorted attributes
this.options.jsonConfig.mappedAttributes = _.clone(this.options.jsonConfig.attributes);
this._sortAttributes();
this._RenderControls();
this._setPreSelectedGallery();
$(this.element).trigger('swatch.initialized');
else
console.log('SwatchRenderer: No input data received');

this.options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html();
if ($(".swatch-attribute.color")[0])
$('.swatch-attribute.color').after('<span>Some text</span>');

,


Here 'Some text'



Now color is your specific swatch code. "You can add your attribute code here"



Please check this.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jul 2 at 8:25

























answered Jul 2 at 7:55









Ravi SoniRavi Soni

1,0415 silver badges18 bronze badges




1,0415 silver badges18 bronze badges












  • and what if in a product there are many swatches how can I choose a specific swatch attribute and add some text to it. I can understand your code however, it work with every swatch attribute, but not with an individual swatch attribute

    – sekiro
    Jul 2 at 8:00











  • Check now I have updated my code

    – Ravi Soni
    Jul 2 at 8:25











  • Oh thanks, I want to ask what is number 0 mean in this line if ($(".swatch-attribute.color")[0])

    – sekiro
    Jul 2 at 8:28











  • I add your code to my module however, it not display next to swatches attribute name it display under them

    – sekiro
    Jul 2 at 8:45











  • Oh. here I come to solution with your code. $('.swatch-attribute.color > .swatch-attribute-label').after('<span>Some text</span>') it will place next to swatches attribute name. Thanks for your help

    – sekiro
    Jul 2 at 8:51


















  • and what if in a product there are many swatches how can I choose a specific swatch attribute and add some text to it. I can understand your code however, it work with every swatch attribute, but not with an individual swatch attribute

    – sekiro
    Jul 2 at 8:00











  • Check now I have updated my code

    – Ravi Soni
    Jul 2 at 8:25











  • Oh thanks, I want to ask what is number 0 mean in this line if ($(".swatch-attribute.color")[0])

    – sekiro
    Jul 2 at 8:28











  • I add your code to my module however, it not display next to swatches attribute name it display under them

    – sekiro
    Jul 2 at 8:45











  • Oh. here I come to solution with your code. $('.swatch-attribute.color > .swatch-attribute-label').after('<span>Some text</span>') it will place next to swatches attribute name. Thanks for your help

    – sekiro
    Jul 2 at 8:51

















and what if in a product there are many swatches how can I choose a specific swatch attribute and add some text to it. I can understand your code however, it work with every swatch attribute, but not with an individual swatch attribute

– sekiro
Jul 2 at 8:00





and what if in a product there are many swatches how can I choose a specific swatch attribute and add some text to it. I can understand your code however, it work with every swatch attribute, but not with an individual swatch attribute

– sekiro
Jul 2 at 8:00













Check now I have updated my code

– Ravi Soni
Jul 2 at 8:25





Check now I have updated my code

– Ravi Soni
Jul 2 at 8:25













Oh thanks, I want to ask what is number 0 mean in this line if ($(".swatch-attribute.color")[0])

– sekiro
Jul 2 at 8:28





Oh thanks, I want to ask what is number 0 mean in this line if ($(".swatch-attribute.color")[0])

– sekiro
Jul 2 at 8:28













I add your code to my module however, it not display next to swatches attribute name it display under them

– sekiro
Jul 2 at 8:45





I add your code to my module however, it not display next to swatches attribute name it display under them

– sekiro
Jul 2 at 8:45













Oh. here I come to solution with your code. $('.swatch-attribute.color > .swatch-attribute-label').after('<span>Some text</span>') it will place next to swatches attribute name. Thanks for your help

– sekiro
Jul 2 at 8:51






Oh. here I come to solution with your code. $('.swatch-attribute.color > .swatch-attribute-label').after('<span>Some text</span>') it will place next to swatches attribute name. Thanks for your help

– sekiro
Jul 2 at 8:51


















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%2f280381%2fmagento2-how-to-add-a-text-between-swatch-configure-and-swatch-attribute-name%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







Popular posts from this blog

Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림