Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

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

Magento 2 - Show Custom Message When Custom Payment Method is not Available

I have a custom payment method that gets a customer attribute and if it doesn't match the value of that attribute the method does not show. I wanted to show a custom message when that happens. I ...
0
votes
0answers
13 views

Add Custom Attribute To Recently Viewed Products Widget

I have override widget_recently_viewed.xml in my theme in Magento_Catalog with <?xml version="1.0" encoding="UTF-8"?> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
2
votes
1answer
27 views

How to call customerData js in phtml on a specific page after page load

I need to call some js in a phtml file only on product details page. I need to check some customer attribute there and show a popup accordingly. The issue I am facing is that somehow I am unable to ...
1
vote
0answers
25 views

How to check a checkbox dynamically Knockout js Magento 2

I am not able to check my checkbox dynamically in knockoutjs. <input type="checkbox" class="checkbox" name="giftoptions" id="printedCard" data-bind="checked: getObservable('printedCard')()"/> &...
0
votes
1answer
8 views

How to add classes input focused on checkout and product review forms?

If an input is in focus or has a value, I want to add a class to all inputs parent .field div. For example on the product page review form or on the checkout page shipping form. If the input is in ...
0
votes
0answers
29 views

Knockout js won't call in custom template admin UI component form

I have call custom template file in UI component and try to call knockout js in custom template but it won't call, I have built it like this. Please let me know if anyone has an idea. Feed/view/...
1
vote
0answers
21 views

How do I get text value for span that is populated with KO?

inside a js file I need to get the value for $('.modal-custom.opc-sidebar.opc-summary-wrapper.custom-slide span.cart-price span.price').text() The probles is that span.cart-price span.price is ...
0
votes
0answers
13 views

Add Widget Script with Component Dependency (avoid setTimeout)

I'd like to run my function after a Magento component is rendered. BUT... my function is defined in a widget block. So is there a way to update this config adding another script? I'm trying to avoid ...
1
vote
0answers
32 views

Magento 2 : Get Customer Data using knockout js in checkout page

While placing the order if customer is not login and after entering email address if customer is already register with us then i need to display first name of customer with message below the email ...
0
votes
0answers
15 views

Magento 2: Billing address same as shipping doesn't work while changing the shipping method

So I have 3 shipping methods on my checkout page, Shipping Method Free Ground Shipping- $0 2-Day Shipping - $15 Overnight - $35 By default, the first one Free Ground Shipping- $0 is always ...
0
votes
1answer
25 views

Edit error message html : Magento 2

Where can I find HTML to add role="alert" to error messages in magento. For example, when a user provides a wrong zip code on checkout page this error message shows up. <div for="postcode" ...
0
votes
0answers
22 views

Magento 2 : How to add value to shipping address from

I am facing issue to add Dynamic value (Via Ajax) in shipping address I was trying to do so with JQuery but validations are failing But my text box has dynamic data assigned to it. please find some ...
0
votes
0answers
55 views

magento 2 - admin create order authorize.net not working

I want to create order from admin/backend with authorize.net accept payment method. Here when we submit order first time it always gives me invalid request to gateway and found that opaqueData ...
0
votes
1answer
27 views

Magento2: How to call js function in custom file

I want to call a particular third party js function in my custom js file. XXX/YYY/view/frontend/web/js/view/payment/method-renderer/cashondelivery-method.js. define([ 'Magento_Checkout/js/...
0
votes
2answers
44 views

Magento 2 : How to get DefaultBillingAddress using knockout?

In core using KO address is get like this in details.html file <!-- ko text: currentBillingAddress().prefix --><!-- /ko --> <!-- ko text: currentBillingAddress().firstname -->&...
1
vote
1answer
43 views

Magento2 : How can i scroll up to first input error validation message on checkout

I saw some simillar questions, but they wanted to remove this feature. They suggested to comment some code in MAGENTO_ROOT/vendor/magento/magento2-base/lib/web/mage/validation.js file if (firstActive....
0
votes
0answers
15 views

How to show in mini cart only when there is at least one product in cart?

I had to add a text from admin configuration( some custom fields) on the mini cart section in frontend. I overrided minicart.phtml and in it I called the method from my Block which returns the ...
1
vote
1answer
29 views

Magento 2 Knockout JS - nested arrays

I've got nested arrays in my config JSON: Each Step node contains own products array. Foreach binding in a template for steps array works fine (the title value is displayed). However, I can't list ...
0
votes
0answers
12 views

Knockout subscribe activates onblur not on change for admin product SKU input

I have 2 inputs on the product form working correctly and firing every time there is a change but any other input I access in the same way as the working 2 is firing onblur or when it loses focus. Is ...
1
vote
0answers
133 views

Render getTemplate() in nested foreach

I am trying to update checkout page layout. What I want to do is to merge progress bar and checkout steps templates. I have updated my app/code/Vendor/Module/view/frontend/web/template/onepage.html ...
0
votes
1answer
54 views

Magento 2 shipping method radio button not display selected on checkout

I have customized the checkout step to make one step checkout. everything is working fine but when I click on select shipping method radio button functionality is working but radio button not display ...
0
votes
2answers
54 views

Magento 2: Translation is not working in html template using data-bind

I have inserted the string to translate into the app/i18n/lg_lG.csv file. I run the command to deploy static files, clean cache, but the string is not translated. The string is located in this file: ...
0
votes
0answers
24 views

Knockout observable admin form field in Magento 2

I would like to get the value of the SKU input in the admin product form. I am currently getting the value using jQuery but would like to start leveraging KnockoutJS. Simply put, instead of using ...
0
votes
1answer
44 views

Magento 2: Knockout JS dependent dropdowns

How can I create a pair of dropdowns such that when one is selected, the options for the other one are updated? The values for options for both dropdowns are coming from PHP. I have absolutely no ...
0
votes
2answers
141 views

Magento 2.3.2 Failed to load the “Magento_Checkout/js/view/billing-address/list” component

I am using one-step checkout and getting an error in checkout console. and also page redirects to /noroute/ 404 page. [ERROR] Failed to load the "Magento_Checkout/js/view/billing-address/list" ...
0
votes
1answer
60 views

Magento 2 : scope of knockout JS variable

Here's my code - define( [ 'ko', 'uiComponent', 'underscore', 'jquery', 'mage/url', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/checkout-data', '...
0
votes
0answers
25 views

knockout js dropdown issue

I have 2 custom dropdowns. HTML: <div class="field"> <select name="addressGroup" data-bind="foreach: getAddressGroups(), value: phoenix"> <option data-bind="value: ...
0
votes
2answers
16 views

Magento 2: display shipping option initially

I have only one shipping method in my store (DHL). It comes with a lot of additional options. But those only show once I click on the method's radio button. This is where the magic somehow happens: ...
1
vote
2answers
48 views

how to override core JS file in module

I am trying to override Magento_Braintree/js/view/payment/method-renderer/cc-form But i am not getting any progress. I have tried map 'Magento_Braintree/js/view/payment/method-renderer/cc-form': '...
1
vote
0answers
50 views

How to get Order Id after place order in javascript?

I am defining placeOrder method in my payment method, here is my code: placeOrder: function (data, event) { var self = this; if (event) { event.preventDefault(); } if (this....
0
votes
1answer
33 views

Adding Minicart to custom header results in a empty cart in magento 2

I tried adding the mini cart phtml to my header like this <?php echo $this->getLayout()->createBlock('Magento\Checkout\Block\Cart\Sidebar')->setTemplate('Magento_Checkout::cart/minicart....
1
vote
1answer
19 views

Filter in custom grid doesn't work normally. Magento2

When I filter twice, it works fine after the third time display only one product in each row. grid_record_grid_list.xml <?xml version="1.0" encoding="UTF-8"?> <!-- /** * Grid record ...
0
votes
0answers
14 views

How to apply bindings and subscribe on change of discount amount totals.totals().items in Magento 2

In my checkout page, on applying and removing promo code, it changes the discount key in totals.totals().items. How to apply bindings and subscribe in knockoutjs, so that I can call my function which ...
0
votes
0answers
21 views

How to call a function on change of window.checkoutConfig data Magento 2

So, I am using window.checkoutConfig data in my js for some calculation. the function works well when called from HTML, but it doesn't run on itself when window.checkoutConfig data is changed. HTML ...
1
vote
1answer
169 views

How to refresh shipping and billing address after checkout page load just like shipping Rates refresh using Knockout Js magento 2

Hi guys, i want to refresh shipping and billing address after checkout page load using Knockout Js magento 2. If you guys have any idea please guide me. Please check the code i tried below ...
2
votes
0answers
36 views

How to use ko.observable on change of data and run a js function Magento 2

How can I run a js function on change of data, So I have heard of knockoutjs ko.observable define([ 'uiComponent', 'ko', 'Magento_Checkout/js/model/totals' ], function (Component, ko, totals) { '...
3
votes
2answers
106 views

Apply bindings and subscribe on change of discount amount totals.totals() in Magento 2

in my checkout page when promo code is applied, I am updating a text using some calculation using knockoutjs In my checkout page, on applying and removing promo code, it changes the discount key in ...
0
votes
0answers
13 views

How to update product details(details.html) in checkout on applying promo code Magento 2

on the checkout page when the promo code is applied, I need to update the item details on the basis of some calculation of promo code for final sale I have to show final sale text dynamically when ...
0
votes
0answers
16 views

How to send data from cart page(phtml) to checkout page(html) for each item in knockout Magento 2

I am doing some calculation for final sale in cart page which is phtml, and I have show final sale in checkout page as well for each item. app/design/frontend/Mgs/yx_theme/Magento_Weee/templates/...
0
votes
1answer
46 views

Magento2: Knockout JS page in frontend give “404”

I have followed this tutorial link HOW TO USE KNOCKOUT JS ON A MAGENTO 2 FRONTEND PAGE. Magenest/KnockoutJs/etc/frontend/routes.xml : <?xml version="1.0"?> <config xmlns:xsi="http://www....
1
vote
2answers
30 views

knockout js text bind giving object instead of string in magento2

I am binding knockout js value to html but it's give me [object HTMLLIElement] insteadof value prescriptionList:{customer_prescription_id: "1", customer_id: "23971", customer_name: "Rutvee ...
3
votes
1answer
116 views

How to get helper method value in knockout js

I created this method in helper : public function getMessage() { return $this->scopeConfig->getValue(self::XML_ERROR_MESSAGE); } I need to display above output in knockout js. ...
2
votes
1answer
178 views

Magento 2: How can get value input with knockout Js?

<input type="hidden" name="test" value="test"/> i want using ko get value of input. my component define([ 'Magento_Ui/js/form/form', 'jquery', 'jquery/ui' ], function(Component) { ...
-1
votes
1answer
41 views

Magento 2: How can write jquery in html file?

I try it but not working with html file <script type="text/javascript"> require(['jquery', 'jquery/ui'], function($){ jQuery(document).ready( function() { alert("Page loaded."); }); }); ...
4
votes
1answer
121 views

How to update checkout/cart/ orders total when promo code is applied dynamically without page reload

I have changed my checkout/cart/ page promo code to ajax call so that it doesn't get reloaded, while on the success of that ajax call, I have to update the total price summary dynamically without ...
1
vote
2answers
221 views

magento 2 How to get dropdown selected value in knockout js on button click

i have my custom payment method in checkout page with dropdown list. and i want to get that dropdown selected value in knockout js and forward it to controller and store dropdown value in my custom ...
0
votes
0answers
48 views

How to get url parameter in knockout js in checkout/index/index/#payment page

I am trying to replace my custom payment method's button called "submit request" to "place order" button when the status is approved. I send status in URL parameter and now want to get it in knockout ...
0
votes
0answers
40 views

Adding custom/extension attribute to shipping/billing address :: js set-shipping-infromation-mixin.js error

Magento 2.3.1 I referred to following link for adding a custom/extension attribute to shipping address https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout_new_field.html However, when ...
0
votes
1answer
123 views

Use new field “Full Name” to replace “First Name” and “Last Name” in Checkout

My idea is to use to add a new field called "Full Name" and it will fill out the "First Name" and the "Last Name" while you type in the checkout. I have almost everything ready but I can't let know to ...
0
votes
1answer
60 views

Get config value in html using knockoutjs

I am trying to get config value to html file. My aim is to check if the config value is enabled of it is show a button and if it’s continue normally with out button the button. I am not sure how to ...