Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

0
votes
2answers
517 views

Magento 2 - How to use 'if…elseif…else' condition in knockout html? [duplicate]

I want to add a condition if...elseif...else in a knockout HTML file. I tried to add the condition like this, <!-- ko if: condition 1 --> [...] <!-- /ko --> <!-- ko elseif: ...
1
vote
0answers
43 views

How to List out product collection in simple table using knowckout js [duplicate]

I have code like below i have tried to implement it with magento custom module.but didn't get it working as it should can any one please guide me how can i implement this.Here i just want to list down ...
0
votes
1answer
225 views

Add class to input element if field is required

In UIs ko template for an input field... theme\Magento_Ui\web\templates\form\element\input.html I would like it to have the class "required" depending on if the field's input actually IS required. ...
0
votes
1answer
189 views

How to show credit card details, address and cart items before placing order?

Is there any way to accomplish this at checkout in magento 2?
1
vote
0answers
165 views

What's the point/gain/advantage of knockout.js in Magento 2? [closed]

I am trying not to let this slide into a rant. I am a long time magento 1 developer and just recently started with m2. I was really excited about the prospects of greater performance and the absense ...
0
votes
1answer
197 views

Render minicart without dropdown dialog

I want to move the minicart to an offcanvas sidebar (foundation 6). I was able to move the minicart vial layout. But it keeps rendering as a dropdown dialog (magento ui) so I would like the cart's ...
2
votes
1answer
973 views

Magento 2: Minicart Failed to load the “Magento_SalesRule/js/view/payment/discount” component

I am working on MiniCart Extension in which I need a coupon code text box in my Minicart. For that I have overridden default.xml in my Custom Module but everytime It returns following error in the ...
2
votes
1answer
269 views

How to set discount value in .js file magento2

I have followed https://webkul.com/blog/set-custom-discount-fee-cart-magento-2/ to get dynamic value. I tried below code. define( [ 'jquery', 'Magento_Checkout/js/view/summary/...
0
votes
1answer
205 views

How to add defer to a custom JS script in magento 2.x

I need to add a custom script in my module and that script requires me to add defer in it. I have added the script in the requirejs-config.js file. But i am cannot see that script working. Although i ...
1
vote
1answer
184 views

Declare 'instance variables' in knockoutjs component?

I'm trying to create a variable in my knockoutjs component that I can reference later on, and it's not really working, and i'm not sure why, can anyone give me some tips on how to access the "text" ...
3
votes
0answers
67 views

Magento 2: Call extension on new checkout tab

To create the new tab on the checkout page I used this link and it is working How to add new steps or tab to the checkout page in Magento2 I want to display this extension on new created tab magento2-...
1
vote
0answers
270 views

Magento 2 knockout js check variable value to specific value

I want to check knockout variable value equal to 1 below is my code: But above code is not working. giving me console error Unable to process binding
1
vote
1answer
3k views

Magento2 : checkbox change function in knockout js

I need to add one checkbox on checkout and call one function on checkbox change event, how can I do that? Check this screenshot for better understanding exactly what I need.
4
votes
2answers
4k views

Knockout If-else condition inside html file in Magento 2

I am customizing the shopping cart page, Here I worked knockout js and html code file. I successfully wrote If statement by below code. <!-- ko if: isFreeShipping() --> //My Code goes here &...
1
vote
0answers
302 views

How add mask to input with knockout javascript?

I need to add a mask to postcode input (ex: 99.999-99), so I have Vendor/Theme/Magento_Checkout/web/template/form/element/zipcode.html with: <input class="input-text col s12 zipcode" type="text" ...
3
votes
2answers
1k views

Magento 2 update progress bar in check out page

What I've tried: i18n/en_GB I've changed this line "Review & Payments,Reviewssss & Paymentsssss" I've also changed this Shipping Methods, This Is my shipping methods and I was surprised to ...
0
votes
1answer
108 views

Cod Message in Magento2?

how to show custom configure message in cod payment method in magento2.. already refer these link.... How to display instructions for custom payment method Magento 2: add html in custom Payment ...
0
votes
1answer
444 views

Magento 2 : How to change input tags value dynamically which is rendered by knockout js?

I need to change product enable option to keep in disabled by default. I used data-index in css to hide the input which works fine but I need to change input tags value. My phtml to switch check box ...
3
votes
2answers
2k views

Magento 2: Shipping Methods not reload automatically

I have problem regarding Shipping Methods update. Shipping Methods value does not update automatically. I have to reload the page every time, so can anybody have a solution for this. I added a custom ...
1
vote
2answers
415 views

Magento 2 - Checkout aria-invalid=“false”

Im not sure if this is a bug, or it's me being silly. What I'm trying to achieve is in the checkout and on an input is the following: aria-invalid="null" However what I've noticed is on initial ...
2
votes
0answers
503 views

Magento 2 Knockout Shipping Method checked in shipping.html

I am looking for solution On checkout page where all shipping methods are loaded. File path is vendor/magento/module-checkout/view/frontend/web/template/shipping.html From above file we can see the ...
1
vote
2answers
2k views

Magento 2 : Display Loader While Ajax call in custom Knockout js

I am using this extension which adds extra fee to quote after select a particular payment. After selecting any payment option it is making an ajax call, I want to show loader until the ajax request is ...
1
vote
1answer
143 views

M2 Can't add new Checkout Step

I'm following the Magento dev docs Add a new checkout step how to guide. But I get the following error in my browser console once I go to the checkout... GET http://example.test/checkout/...
1
vote
0answers
458 views

Magento 2.2.1 : Add Custom Field in Login Form On Checkout Page

I have added custom field in checkout page using below code: $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] ['shippingAddress']['children']['...
3
votes
1answer
1k views

add custom js to the certain input element on the checkout page

My final goal adds custom js to the certain input element on the checkout page what i tried To get element with uiRegistry and on redner add needed code, but failed, i can work with tjis element ...
1
vote
1answer
880 views

Magento 2 UI grid non db dataprovider and pagination issue

I'm trying to us the UI grid component to create a grid in the backend that displays information that's not from the database. So far I created the XML files, the controller and a custom data provider....
3
votes
2answers
570 views

Magento 2 - Add success message with knockout

I need add an errorMessage or successMessage on checkout/cart after an jquery validation. I tried require file 'Magento_Ui/js/model/messageList' for this but not have success. My code: define( [ ...
0
votes
1answer
521 views

Debugging Magento Checkout- Property getType of Null, when messing around with Billing and Shipping Address

I am doing some heavy customization on the checkout (pulling billing address to the first position, next to shipping address). If have added a plugin to view/shipping.js: define( [ '...
1
vote
1answer
297 views

Magento 2.2: How can I load the content of a table with Knockout JS when the page is rendered

I have created a custom page where customer accounts that belong to the same company are listed. The table content is based on an observable array so that it updates automatically when an account is ...
1
vote
0answers
135 views

Checkout Page Custom Field data is not saved in Magento 2

I prefer below link ant try to create custom field to checkout page in magento2 and field was created successfully but the data is not saved. Link:-How to Add Custom fields to Checkout page in ...
0
votes
1answer
283 views

Magento 2x child theme js error

I have created child theme for magento 2x and it's parent theme is porto theme. After create child theme everthing is working fine but sometime I have got the following error. Uncaught TypeError: $....
1
vote
0answers
52 views

Custom Block on Checkout Page Sidebar

I want to add custom module's block on the checkout page in the sidebar below all the elements. How can I do so? It will be helpful if anyone can guide or provide correct steps or any sample code.
2
votes
0answers
922 views

Update Options of a Select Element Dynamically using Knockout Js

I am looking for updating a custom Select Option at Checkout. <select name="city" id="city" data-bind=" options: availableCities, optionsText: 'name', optionsCaption: 'Select City', ...
2
votes
0answers
123 views

minicart ko in magento2

Js file qtyOptions: ko.observableArray([]), initialize: function () { this._super(); for (var i = 1; i <= 4; i++) { this.qtyOptions.push(i); } return this; template file &...
2
votes
2answers
148 views

Related Products, Up-Sells, and Cross-Sells modal panel error

After moving to Magento ver. 2.2.2 from Magento var. 2.1.9 the Related Products, Up-Sells, and Cross-Sells modal panel from catalog product edit doesn't show anymore. I can see these error in the ...
1
vote
0answers
20 views

Minicart -product_sku in Magneto2

Below file contains product_sku value. view/frontend/web/template/minicart/item/default.html file. how to get/use product_sku in custom js file .If anyone knows please explain me
1
vote
1answer
691 views

Change minicart Qty to Dropdown in magento2

I want change qty text box into dropdown in minicart place view/frontend/web/template/minicart/item/default.html file. <select data-bind="attr: { id: 'cart-item-'+item_id+'-qty', '...
1
vote
2answers
105 views

ko syntax in Magento2

How to pass option value dynamically in Magento 2 using ko. web/template/minicart/item/default.html I want the loop for(i=0;i<=5;i++){ <option>i</option>} But I can able to pass ...
0
votes
1answer
303 views

Magento 2 - How to override checkout-loader.js

I want to override magento_checkout/js/checkout-loader.js file with my custom module ( using require js ) here is my requirejs-config.js file : var config = { "map": { "*": { '...
11
votes
1answer
2k views

How to share Knockout JS observables between UI Components

I understand how to use imports: {} and exports: {} to share a UI components properties, such as: defaults: { exports: { shouldShowMessage: '${$.component}' } } Which returns the ...
0
votes
1answer
262 views

Knockout.js breaks in /checkout in my theme

I use magento 2.2.1 with a purchased template and on "Enable Onepage Checkout" option enabled. The problem is the template is broken by almost everywhere and the author is irresponsible (I sent ...
2
votes
2answers
958 views

Magento 2.2: How to add country and region drop-downs in a custom step form in one page checkout?

I need to add a custom step in Magento which verifies the address of the customer via a third party API, the fields are similar to the shipping address form, but I could not find out how the country ...
0
votes
0answers
375 views

Magento 2 : How to change UI field(s) dynamically

On checkout page on country selection i want to change postal zip code from text box to select list with options dynamically ( like region_id ). For example, if zip code are available for certain ...
2
votes
3answers
2k views

Caching problem for html and js file in Magento 2

I am working on Magento 2 knockout js. But when I am changing HTML or js file it's not effecting on frontend I run all this command setup:upgrade, static:content:deploy, di:compile, cace:flush But ...
1
vote
1answer
569 views

Reviews in magento 2

I have modified the review form in my custom module and makes the review form to show as a popup modal.And I don't need review tab. So I have removed the review tab, after removing review tab it ...
1
vote
2answers
190 views

how to remove shipping cost from magento2 checkout summery

I am a beginner to Magento 2 and based on my some research I see that this whole block of cart subtotal is coming from /vendor/magento/module-checkout/view/frontend/web/template/summary/totals....
3
votes
0answers
342 views

When to use mixins and when to use map?

I'm following magento 2 official documentation to create my checkout step. I'm very new to knockoutjs, requirejs, js components which are massively used in magento 2, specially in checkout. I'm ...
0
votes
0answers
210 views

How to stop loading the page using knockout js after the event has completed in magento 2

I am adding the custom price to order total, its fine adding the price.but the page loading is still loading, how can i stop loading using knockout js. Thanks in advance i have this code in my ...
2
votes
1answer
54 views

Understanding javascript code return componet.extend({}); in magento 2

I am new in magento 2 and requireJS Can someone explain to me what "return componet.extend({}); " means when I am trying to add new JS module
1
vote
2answers
412 views

magento 2 : How to use observable.publishOn or observable.subscribeTo with ko js

I am getting following error while use publishOn and subscribeTo method of knockoutjs TypeError: ko.observable(...).publishOn is not a function Here is the script jsfile1.js define([ 'jquery', '...