Skip to main content

Questions tagged [knockout]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
38 views

magento2 how to get custom block value on shipping knockout template

How to get the value of a custom block in Knockout Shipping's template. My code is: Vendor/Extension/view/frontend/layout/checkout_index_index.xml <?xml version="1.0"?> <page xmlns:...
Keval Chauhan's user avatar
0 votes
0 answers
149 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
0 votes
1 answer
89 views

Add new tab in cart page with form in Magento 2.4.4

I want to add a new Tab on the cart page with a custom form. Thank You.
Ronak Rathod's user avatar
  • 6,342
1 vote
0 answers
864 views

How can I display normal price and special price in minicart?

In the mini cart default, a special price will show if a product has a special price (calculated price). I need to show both prices regular price and special price in mini cart. Please suggest me a ...
sagar nakrani's user avatar
2 votes
1 answer
855 views

Magento 2.4 Failed to load the knockout component

Good morning, could someone help me with the error "Error loading the component "Custom_Module/js/customer-lines" that occurs to me when loading a JS knockout file, the error appears a ...
GStiven's user avatar
  • 41
1 vote
1 answer
121 views

How to get call modal('closeModal') from authentication.html

Question How do I get access to the underlying modal object from a UiClass object? This Magento Stackexchange answer shows how to call closeModal on a modal window: https://magento.stackexchange.com/...
CvRChameleon's user avatar
1 vote
0 answers
24 views

Region Text is not passing along with form

I have created magento admin form using Uicomponent with country and state everything working fine except region value is not passing along with form.This happens only when there is select box ...
M2 Dev's user avatar
  • 548
0 votes
1 answer
358 views

call function inside ko.bindingHandlers knockoutjs

I'm trying to call a custom function inside the initialize ko.bindingHandlers function but getting the below issue. Message: Cannot read properties of undefined (reading 'tConvert') My code for ...
Ramesh KR's user avatar
  • 876
0 votes
2 answers
644 views

How to add script for checkout item default file?

how can I add script for Magento_Checkout/web/template/minicart/item/default.html file? I have to add data-bind="click: {}" to the product, but I don't know where I should place my function? ...
mrcl's user avatar
  • 37
1 vote
3 answers
5k views

Failed to load the component. : M2

phtml file: <?php $mycollection = $block->getMyCollection(); ?> <?php if ($mycollection) : ?> <div id="my-component" data-bind="scope:'myComponent'"> ...
Jimit Bhavsar's user avatar
0 votes
1 answer
400 views

Onclick bind image using knockout js

I want to show image from allDoorColorStandard. HTML: Onclick "color-data" div , i want to update image. In alert i'm getting image URL, now need to bind in image tag. <div data-bind=&...
Jimit Bhavsar's user avatar
0 votes
1 answer
1k views

Magento 2 : Knockoutjs data-bind not Working in Inner Loop

Case 1: -- Working HTML Test::<span data-bind="text: $parent.testText"></span> <button data-bind="click: $parent.testbtn"></button> JS numberOfClicks : ko....
Jimit Bhavsar's user avatar
4 votes
7 answers
8k views

Magento 2.4.3 - Checkout JS knockout error - renderReCaptcha

We upgrade to Magento 2.4.3 and now face the following JS knockout error in the checkout: TypeError: Unable to process binding "afterRender: function (){return renderReCaptcha() }" Message: ...
JGeer's user avatar
  • 1,420
0 votes
1 answer
1k views

How to refresh or observe the Item is been added to cart using knockout JS UI component?

I have added a custom function which checks if the product has already been added in a quote or not. This works fine and shows button text accordingly. The only issue that it requires to refresh the ...
kamlesh.bar's user avatar
0 votes
3 answers
2k views

Magento 2 knockout js onchange selected value not working

I'm working on checkout page. I cannot get the selected value from the event. My Html <select name="addresslist" id="addresslist" data-bind="event:{ change: regionChange}&...
Ramesh KR's user avatar
  • 876
0 votes
1 answer
956 views

Magento 2: using knockout components within a component

I am trying to render a new KO component within a existing KO template. I have a PackagePopup component which in the template, renders a PackageFfilter component. I would like to seperate the logic ...
user2594875's user avatar
0 votes
1 answer
520 views

Magento 2 - Check in minicart if customer is loggedin knockout

We want to check in the minicart if the customer is loggedin. <!-- ko if: isCustomerLoggedIn == 1 --> Does not seem to work well for the mini cart. This only works when you are visually in the ...
JGeer's user avatar
  • 1,420
1 vote
1 answer
209 views

Magento 2: How to check inarray ids in minicart.js

getCartItems: function () { var items = this.getCartParam('items') || []; _.each(items, function (item, key) { console.log(item.product_id); ...
Shomita's user avatar
  • 1,123
2 votes
1 answer
945 views

Magento 2: I want to get product id from getCartItems function in minicart.js

Here is the function in minicart.js getCartItems: function () { var items = this.getCartParam('items') || []; console.log(items); // want to get product id from ...
Shomita's user avatar
  • 1,123
1 vote
0 answers
199 views

Magento 2 - Check in mini cart if product is virtual

How can we check in the mini cart if the product is virtual using knockout? Inside the cart and checkout we can use the following, but that is not working in the mini cart. Any idea? <!-- ko if: (...
JGeer's user avatar
  • 1,420
0 votes
2 answers
784 views

Show Widget in the Html

I have an html file for checkout where I want to show the widget which is coming from the database . Instead of displaying the widget it shows widget code. I have attached screenshot of the same. ...
Max's user avatar
  • 1
0 votes
1 answer
2k views

Add foreach loop in knockout

I am using the following condition and its print one value, if(self.options.nearestlocationsBlock) { var firstStore = _.first(locations.items); var newContent = '<div class="store&...
zus's user avatar
  • 175
0 votes
1 answer
1k views

Magento 2 - How to add custom attribute in knockout "data-bind="html: 'Product Attribute : ' + product_sku "

I want to show my custom attribute on the wishlist sidebar section, how to add my custom attribute "brand & Size" attributes into this, eg: <div data-bind="html:product_brand &...
zus's user avatar
  • 175
0 votes
1 answer
243 views

Magento 2: Translate knockout html where "mailto:[email protected]" is used

In Magento_Checkout/web/template/minicart/content.html there is a "mailto:[email protected]" used. Now I can translate the last piece by -- ko text: $t('[email protected]') --> <-- /ko --...
Always_home's user avatar
0 votes
0 answers
349 views

Magento 2.3.2 - Very weird checkout cache issue

Hoping someone can help here. We have a Magento 2.3.2 website. There's nothing particularly special, functionality wise about it. It uses cloudflare, which could be a cause, but the hosts assure us ...
Thomas Harding's user avatar
1 vote
0 answers
300 views

Magento 2 uiComponent multiple instance

I have a view with two templates that use the same uiComponent with Knockout Js. I spent hours trying to discover how to do not share the observables between two different templates. example: <div ...
martin's user avatar
  • 49
0 votes
2 answers
1k views

How to make div collapsible in ko template?

We often want to make store credit or adding gift card div collapsible on checkout page. How to make store credit or customer balance div collapsible in knockout template?
Kazim Noorani's user avatar
0 votes
2 answers
2k views

Knockout observable is not accessible inside function

So I am working with Knockout inside Magento 2.3.4, and I am setting a custom observable value on initialize, and then I am trying to access that observable and change the value inside a function. ...
Erica S.'s user avatar
0 votes
1 answer
2k views

Magento 2 Knockout bind on ajax response

I am going crazy with knockout on Magento 2, I am new to knockout and I cannot understand what I am doing wrong. I know there are some related questions posted there but each one is different from ...
George George's user avatar
0 votes
1 answer
46 views

Moving Coupon Block in Checkout Knockout Error

I moved the Discount block from the billing-step to the Sidebar in the Magento 2 checkout. I disabled the original discount block in the billing-step but I am still getting the following JS error: ...
Eirik's user avatar
  • 2,073
0 votes
1 answer
1k views

Knockout - Unexpected identifier (SyntaxError: Unable to process binding)

I am getting the following error in the browser console: knockout.js:2982 Uncaught SyntaxError: Unable to process binding "ifnot: function(){return customer().fullname }" Message: Unable to ...
CvRChameleon's user avatar
2 votes
0 answers
428 views

knockout data-bind issue on the Frontend Magento 2

I have added file-uploader component in the review form. I have used below code to add browse button in the form. <div class="upload-wrapper" data-bind="scope: 'uploader'"> ...
Sunny Rahevar's user avatar
3 votes
3 answers
2k views

Magento 2 Knockout variable from response in controller via ajax

Assume I've got something like this <div class="greet welcome" data-bind="scope: 'customer'"> <!-- ko if: blockIsLoggedIn == '1' --> <span data-bind="...
Dominic Pixie's user avatar
0 votes
1 answer
2k views

Get subtotals excluding tax for each Tax Rate in Cart summary - Magento 2

I need to calculate the SubTotal for each tax rate in my cart summary.. How can I do this? I found calculation start in module_tax under vendor / magento folder.. but I did not found where to put my ...
vvave vvave's user avatar
1 vote
0 answers
148 views

Magento 2: Preload shipping estimation without filling up shipping address details

In checkout cart summary, is there a way to preload the shipping estimation without filling up the detail and choosing the shipping method? so when we first load it will show subtotal, shipping rate, ...
jojo's user avatar
  • 39
0 votes
0 answers
27 views

Change cart qty from onestep checkout

I need to change cart qty via js while on the /checkout page(not in /checkout/cart). Then start the checkout process again with new data. Is this possible?
Kawafu's user avatar
  • 1
1 vote
0 answers
243 views

How can i Stop calling event bind with data-mage-init

I am implementing infinite scroll in a custom collection which is working perfectly but in my case when i filter out this collection and update collection item with ajax response still the previously ...
Hiren's user avatar
  • 1,091
1 vote
0 answers
197 views

ko template: getTemplate() after AJAX not working(DOM append)

Page with products has loading by ajax(infinity scroll loading), response with products are Html page, from which new products search by class(Jqury) and appended to existing page, as a result is a ...
Alexandr Chernyakov's user avatar
0 votes
1 answer
559 views

'getFormattedPrice' undefined on checkout

I need to get a list under each product in the form: - Unit price - Amount - Amount based on price and quantity Rewrite template: vendor/magento/module-checkout/view/frontend/web/template/summary/...
ann karsksya's user avatar
1 vote
2 answers
471 views

Hide company field on checkout step based on customer group in Magento 2.3?

I am working on checkout step for hiding the company field on the basis of customer group. can anyone help me to solve this ? Thanks
usman's user avatar
  • 465
1 vote
1 answer
750 views

knockout template html file in adminhtml area is not rendering

I am trying to initialize the knockout component in the admin html area, the respective code is below. phtml file to initialize ko template <?php /** * @var \JC\ChatSupport\Block\Adminhtml\...
Jaya chandra's user avatar
2 votes
1 answer
716 views

How to translate text in shipping-estimation.html

I need to translate the text Enter your billing address to get a tax estimate. in vendor\magento\module-checkout\view\frontend\web\template\cart\shipping-estimation.html It is a text showing in the ...
Black's user avatar
  • 3,390
2 votes
1 answer
11k views

Add custom javascript in afterRender in Magento 2 with knockout

I`m trying to load a custom script after a custom-template for minicart items is rendered. I created a javascript file vendor\module\view\frontend\web\js\test.js: define('jquery', function($) { ...
Mario's user avatar
  • 478
0 votes
0 answers
3k views

Magento 2 : ko observable variable checking in template file

I have created a custom payment method using knockout js. I want to display a form only for selecting a drop-down value "Add new card". I have created a KO variable and assign the value initially as ...
Jancy Abraham's user avatar
1 vote
0 answers
1k views

How to pass value from template.html to js in magento 2 knockout js when complete entering the input field?

1) I need to pass the phone number value to the telephone.js when complete entering the number before the button click. 2)Below the phone number field, I added the OTP input field (i added it in the ...
Arul's user avatar
  • 309
1 vote
0 answers
63 views

How to add selected items on a page to a separate block in Magento 2?

Please help with the implementation of this functionality. I have a separate module with a separate route. There will be elements on the page (picture and checkbox under it) as in the screenshot. ...
ann karsksya's user avatar
2 votes
1 answer
2k views

How to call knockout functions from html (Magento 2)

I have functions defined in my knockout js, define([ 'Magento_Ui/js/form/form', 'ko' ], function (Component, ko) { 'use strict'; function viewedProducts() { let rvp = JSON....
summu's user avatar
  • 847
0 votes
1 answer
79 views

Magento2 : Show Three Products on Checkout page in Order Summary section

I have added 8 products in the cart and now I would like to show three products on Order Summary section on Checkout page with a Load More button. And, if we click on Load More button, it will show ...
Hitesh Koshti's user avatar
1 vote
0 answers
176 views

Show all error messages in one place in one page checkout

I want to show validation messages in one place. for example. <div class="checkout-error-message"> * Please fill address field * Please fill email field * Please check agreement and term </...
yvzyldrm's user avatar
  • 309
0 votes
0 answers
101 views

Magento 2.3.2 Enterprise Banner Slider Issue

I am experiencing that the default banner slider is not compatible with the mobile devices in Magento 2.3.2 enterprise version. Slider is working fine for the desktop. Can anyone help me to understand ...
Kamlesh Yaduwanshi's user avatar