Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

Magneto 2 - Show related products to mini-cart

Good afternoon everyone, I am looking to show related products under the products in the Magento2 mini-cart. I have added related products to the product page no problem and added cross sells to the ...
Baber's user avatar
  • 190
0 votes
3 answers
86 views

How to hide admin product form tabs for specific admin user?

I want to have an admin user who would only be able to view the 'Images And Videos' and 'Search Engine Optimiation' in the admin product edit form. I tried the following. Created app/code/Vendor/...
Aniruddha Ray's user avatar
0 votes
1 answer
37 views

Magento2. KnockoutJs. Define Scope and call function on the same html node

I have a very simple Component define([ 'uiComponent', 'Magento_Customer/js/customer-data' ], function (Component, customerData) { 'use strict'; return Component.extend({ /** @...
vitoriodachef's user avatar
0 votes
4 answers
58 views

Redirect link for multiple store

I have a small problem and don't know how to implement redirect based on selected language (as a multiple store views there are few languages: en, lt,lv). The file located in app/design/frontend/...
Veronika Petkeviča's user avatar
1 vote
3 answers
361 views

Magento 2 Google language translate script not working

The script was functional on our Magento 2 website until last week. However, for the past four days, we've been encountering JavaScript and Knockout.js errors in the console when this script is active....
Keval Chauhan's user avatar
0 votes
0 answers
28 views

Where is this.address() defined in vendor/magento/module-checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js?

I try to figure out where this.address() is defined in vendor/magento/module-checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js ? /** * Copyright © Magento, Inc. All ...
Black's user avatar
  • 3,280
2 votes
2 answers
74 views

How to set radio buttons in custom payment method as required

So, I have set up a payment method (Leasing) - when chosen, you have the choice between different leasing providers. It is working so far, as the providers are shown in the checkout, I can click them ...
Mario's user avatar
  • 478
0 votes
0 answers
34 views

How to add custom checkout fileds fetched from DB?

How can I make a new, custom, checkout fields fetched from DB? I have created a new table where I keep fields names, also I created a Model, Resources, ResourceModel (admin can modify or add new one ...
miguelsantos69's user avatar
0 votes
2 answers
56 views

How to use click event on page load in knockout

<div class="free-sample" id="free-sample-component" data-bind="scope:'free_Sample_Component'"> <button id="get-free-sample" data-bind="click:...
Mital Shah's user avatar
1 vote
0 answers
18 views

Get category data from id in knockout html template

State of the art Using a custom type for the page builder, i'm generating this html <div class="gamme-content"> <h3 data-element="title">Discover our others ...
Claims's user avatar
  • 1,146
1 vote
0 answers
57 views

How to show preview selected options of multiselect attribute in magento2 product form?

I am trying to extend the Magento multiselect element to show the preview of options selected as per below screenshot. https://i.stack.imgur.com/uUYtR.png I tried to override Template file and js ...
Yogendra - eCommerce Developer's user avatar
0 votes
0 answers
91 views

Knockout Error: Found End Comment Without a Matching opening comment, as child of [object Text]

I'm getting a KO error complaining about a missing opening tag regarding the following code. I don't know much about KO but it looks like the the KO tags all match up. <!-- ko if: (visibleAddress)--...
totneschap's user avatar
2 votes
1 answer
167 views

check condition in foreach loop with dynamic variable in knockout js

I have html file at the path /var/www/html/nelson-avnet-app/code/vendor/module/view/frontend/web/template/shipping-address/list.html <!-- ko if: (visible)--> <div class="field addresses&...
divyang asodiya's user avatar
0 votes
0 answers
40 views

Magento 2: Add custom value to $parent in checkout summary

I want to add a custom value to the items in the order summary during checkout ($parent). I followed all the other howtos on how to do it: Create plugin for Magento\Checkout\Model\...
omsta's user avatar
  • 698
0 votes
2 answers
109 views

Magento 2 / Knockout js add image in form field notice

I want to add html tags to the notice of a specific field, I tried in LayoutProcessor but it does not interpret the image tags, I know it is possible from the field.html file, but it did not work for ...
Diego Castro's user avatar
0 votes
1 answer
97 views

how to add Strike through on original price and show cart rule discounted price

add strike through on the price and show the discounted price after strick through price on the checkout shipping step summary section
Nabeel shahbaz's user avatar
0 votes
0 answers
132 views

How to update grandtotal using knockout JS in Magento 2 checkout page

I've added a text field where customers can enter a coupon code. When click the "Apply Coupon" button, I am fetching the value of the coupon. I want to use this coupon value to adjust the ...
manoj kumar's user avatar
0 votes
0 answers
24 views

Pre-Select checkboxes based on custom condition in Magento 2 using KnockoutJS

I want to override a third party module's knockoutJS template (below) and want to pre-select the checkboxes based on my custom condition. Can anyone help me with code to how to do that? And if ...
Shahzad Hasan's user avatar
1 vote
0 answers
78 views

totals.getSegment('giftcardaccount') returning null

I'm about at my whits end. I still consider myself a relative novice with Magento, but this one literally has me baffled. I've also tossed it around to some senior devs at my work, and they are ...
Drew's user avatar
  • 131
0 votes
0 answers
53 views

Magento 2 getting errors on all page Unable to process binding "attr: function

I am getting errors on all pages anyone knows please give me solutions on how to fix it. Please check screenshot Errors:- Uncaught ReferenceError: Unable to process binding "attr: function(){...
Mohamad Irshad Alam's user avatar
0 votes
0 answers
22 views

Prefill billing address data with custom adress array for guest

Hi all is there a way that i can pass custom billing address array to prefill billing address data on review and payment page $csutomerAddress = [ 'firstname' => "testname" ]; currently i ...
Pramod's user avatar
  • 1,444
0 votes
2 answers
334 views

Minicart: failed to load template

I'm using a custom template and having an issue with the minicart rendering. The minicart pop-up renders, but does not gather any data with 2 errors in the console. So the popup does open when you ...
BroodjeBE's user avatar
0 votes
0 answers
50 views

How Add PO Number Field for All Payment methods

On checkout, there should be an input field for the PO number Input needs to be available for all payment types and must be required. Hide the default PO number in the Payment on Account payment ...
Nabeel shahbaz's user avatar
0 votes
0 answers
39 views

Magento 2 / Add Buy Now button in Recently Viewed Products

I want to add "Buy Now" button in Recently Viewed Products widget, the widget is made with knockout js. The file involved in the widget is: /Magento_Catalog/web/template/product/list/listing....
Diego Castro's user avatar
0 votes
0 answers
71 views

Magento 2 / Add Buy Now button with knockout js (html template)

I am adding the Buy Now button in all sections. I have been able to add it in almost all sections, but I have a block in one part of the home that brings the recently visited products and the front is ...
Diego Castro's user avatar
0 votes
2 answers
378 views

Magento 2 - Get location of view model of knockoutjs .html template

For example, how can I find out where the model / view model for this template is located at? vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html
Black's user avatar
  • 3,280
0 votes
1 answer
320 views

Magento 2: How to show error inside payment method?

I am using Magento 2.3.5 and i need to show the error message on checkout page inside the payment method component, how can achieve that? Actually shows this way (Top of the page) I want to to show ...
Carlos A Magaña Perez's user avatar
1 vote
0 answers
221 views

How to get selected shipping address from js component in Magento 2?

I'm very new to the Magento world and I'm trying to figure out how do I get the currently selected shipping address in Magento 2. The goal is to only display the selected shipping address in the ...
Danil Hendra's user avatar
0 votes
0 answers
133 views

Caught TypeError: self.AnyFunction is not a function

I am trying to modify the default Magento 2 Checkout, basically I want to remove the "Payment and Review" step and put them all together. Everything goes well but I have stuck intro an issue....
George George's user avatar
1 vote
2 answers
698 views

Magento 2: Custom component fails to load when implementing Magento_Checkout/js/model/totals

I have created a custom Knockout-Component that so far does not do anything. It is just the basic skeleton but it already fails to load. Template: <div class="my-module" data-bind="...
omsta's user avatar
  • 698
0 votes
0 answers
25 views

How to use js from library inside data-bind scope

I'm trying to use sortable with below code: <ul id="sortable-list"> <li> <div> <span class="sort-handle">Sortable Item #1</span&...
Harry Nguyen's user avatar
  • 2,815
0 votes
0 answers
50 views

JavaScript not executed when it has Magento_Customer/js/customer-data dependencia in define

I have a JS file like this: define([ 'jquery', 'underscore', 'matchMedia', 'text!ajaxcart/template/modal-slide.html', 'text!ajaxcart/template/modal-popup.html', ...
Eliacim DAVILA - CENSERE's user avatar
0 votes
0 answers
81 views

sometime all knockout js files can't initialize in magento 2 (examp: Magento_Checkout/js/view/minicart, ....)

I'm using magento community-edition ver 2.4.5 When I reload the page many times(any pages), there will come a time be all knockout js files not initialize, it doesn't run into initialize function. ...
intary's user avatar
  • 11
0 votes
1 answer
148 views

How to make Shipping address search function in checkout?

I want to make a function where users can search for the address from the shipping address list at the checkout page. Right now there are many B2B Magento stores globally. So Might they have a huge ...
Pragnesh Boghani's user avatar
2 votes
0 answers
321 views

Magento 2 : Codazon Fastest Theme js not loading propperly

I Have Installed Codazon Fastest Theme on my Manto2 site.i am facing an issue with js loading. here is my system configuration below. magento version : 2.4.5 PHP: 8.0 theme: Codazon Fastest Theme ...
sandip memariya's user avatar
1 vote
1 answer
59 views

How to add new section below shipping method and above next button on checkout page - Magento 2.4

I searched for the reference URL from that I can able to add above the "Shipping Method" or below "Next". But Not able to add the text box between "Shipping Method" and &...
Kushal Dani's user avatar
  • 2,104
1 vote
2 answers
518 views

Translate dynamic text in magento 2 javascript

i have a text like within %1 days %1 is dynamic how to translate using data-bind:i18n in html template magento 2.4 <span data-bind="text:methoddata[key].delivery_days_text"></span&...
we testers's user avatar
2 votes
0 answers
429 views

How to allow to upload mp4 video on page-builder in magento 2

I am trying to create a custom component for upload mp4 video like image uploading component. Video is uploading and save fine and also show on front cms-page but after the save video will be remove ...
Divya Rawat's user avatar
0 votes
0 answers
33 views

Selected address is not showing in default ko template from Shipping address list drop-down select on checkout Magento2.4.5

We followed the link for creating shipping address drop-down on checkout page. I put all files under Custom theme's Magento_NegotiableQuote module. Drop-down with shipping address showing correctly ...
Minas Jean's user avatar
0 votes
0 answers
63 views

Magento2 Add Custom Fields in Shipping and Billing address forms at checkout based on current country

We have setup multi-websites in magento, we want to add a field in checkout shipping and billing form only if customer is visiting particular country website. Ex. if customer is visiting US website ...
Prasanth's user avatar
  • 147
0 votes
0 answers
39 views

What is the purpose of getTemplate() in knockout Js Magento 2?

I'm learning Knockout JS in Magento 2. There is a function getTemplate() whose syntax looks like this. I want to know its working and purpose. FilePath: app/code/CloudyDigitals/LearnKnockout/view/...
Sufyan Akhter's user avatar
0 votes
1 answer
147 views

Magento 2.4.4: Attach event handler to Province dropdown to reload the checkout page

We developed a custom shipping module that displays shipping methods and the rates in Firecheckout page. The issue is the Shipping Method block in the firecheckout page doesn't refresh if one changes ...
CodeForGood's user avatar
0 votes
0 answers
93 views

Magento2 : How to save chosen dropdown list from template to the database

The selected option is not being save in the databse, please help what i did wrong? I'm running magento 2.4.4 with php 8.1 event.xml <?xml version="1.0"?> <config xmlns:xsi="...
Bayzel's user avatar
  • 187
0 votes
1 answer
280 views

can anyone find out the error in this knockout js code

this is phtml file located in Namespace_ModuleName/view/adminhtml/templates/js_time.phtml <div> <h4>Current Time is:</h4><span id="time_show" data-bind="text: ...
mrshiam's user avatar
  • 15
0 votes
1 answer
147 views

Base price, discounted price and percentage discount in the summary checkout

I need to have the discounted, base, and percentage off prices in the summary checkout. I found the file that prints and it is this checkout/summary/item/price/row_excl_tax.html but I can't retrieve ...
yavonz15's user avatar
  • 417
0 votes
1 answer
49 views

How to learn knockout js. Please help to learn about js,

**How to learn knockout js. Please help to learn about js.
Ayush Gupta's user avatar
2 votes
1 answer
41 views

Magento 2 change the addtocart button text on detail page based on the product increment

I am doing customisation on PDP page as per my client requirement, For my requirement i am using the grouped product, also added a option to increase/decrease each product quantity count, when ...
senthil's user avatar
  • 1,729
0 votes
1 answer
128 views

How to initialise Magento Requisition over AJAX?

I have tried several ways to initialize Magento RequisitionList after AJAX call. First I tried with data-mage-init Please correct me if there is anything wrong. I have used the underscore JS template ...
Pragnesh Boghani's user avatar
0 votes
1 answer
273 views

Find Javascript Merge Knockout Error In Extensions Uncaught Error: Cannot find closing comment tag to match: ko template:

Magento 2.4.3 Apache Nginx MariaDB Hello Thanks for taking the time to read this. We have a dev site we are trying to enable Swissup Pagespeed Extension however it is getting 1 error - the merge ...
nem3943's user avatar
  • 43
1 vote
1 answer
352 views

Unable to access custom data section using customerData.get() inside KnockoutJS component

I am following this in order to create new section https://developer.adobe.com/commerce/php/development/cache/page/private-content/ All is working if I request '{localhost}/customer/section/load', the ...
Ilja Polanskis's user avatar

1
2 3 4 5
17