Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

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

Property “RemoveTag” does not have accessor method “getRemoveTag” in class “Magento\GiftMessage\Api\Data\MessageInterface”

I am working on an extension attribute in cart page. I need to add a text box (remove_tag) along with the other text boxes for gift messages. On clicking on update button i am getting the following ...
0
votes
2answers
25 views

How to call function from another function using magento knockout js?

I need quick help regarding calling a function within a function using Magento knockout js, I have tried this define([ 'ko', 'uiComponent' ], function (ko, Component) { 'use strict'; ...
0
votes
1answer
22 views
1
vote
0answers
9 views

Magento 2 how to add date of birth in checkout (date picker)

I want to add the date of birth date picker in checkout only for guest users. I have read a few things which indicate that I have to use knockoutjs. But I wasn’t sure what is the correct way to ...
0
votes
2answers
310 views

Not showing messages at onestepcheckout in magento 2.2.x

After the ajax process get the error from the payment api i can see that the Magento_Ui/js/model/messages.js it triggered and the message should be added to the list but I cant see anything in the ...
0
votes
0answers
8 views

Magento 2: Knockout Template display messy content during inline - translation

I am getting strange issue while enabling inline-translation. All knockout template display messy (All titles are in curly braces). Why is this happening? Please help and suggest. Thank you in ...
2
votes
1answer
1k views

Magento 2 UiRegistry can't get component element

this my checkout_index_index.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/...
0
votes
1answer
908 views

Magento2 - How can I display a product attribute value in Order Summary block?

I am trying to display a product attribute value - SKU in Order Summary block. I have found the template where it is displayed: vendor/magento/module-checkout/view/frontend/web/template/summary/item/...
4
votes
0answers
265 views

Magento 2 : Can We Convert Price Into Ceil Price

I have setup multi store view with multiple currency. Everything is working as expected. Now, I got requirement to convert all prices into ceil. (e.g, SR20.02 = SR21). For this task, I have ...
0
votes
0answers
19 views

how to create custom cheqout fields using KnockoutJS and access fileds data in js component Magento 2?

Basically i am working on custom payment method by which i need to add custom fields there .when user submit that fields ,how to get data which user fill in form in JS file.
0
votes
0answers
15 views

How to create a custom KnockoutJS form in Magento 2?

Basically i want to create a form using KO-JS and use that form in checkout step .I have many many blogs .In every blog the writer use Magneto default form named is cc-form ?is there any way to add a ...
0
votes
0answers
14 views

Magento 2 - How to show additional column value of quote_item table in order summary on checkout page

I have created a two columns in quote_item table (delivery_note & delivery_date) and by using event observer I have populated values for each product in the cart, now I need to show these values ...
0
votes
2answers
769 views

Accessing a JS function from another JS file

I'm trying to access a function from 'create-validation-list.js'. define([ 'jquery' ], function ($) { return createValidationList = function () { // Code } shipping.js define([ 'jquery', '...
0
votes
0answers
18 views

How to make Magento 2 second address field show inline without popup?

When clicking on the new address button, Address field show below the button inline without an open popup. Look like extend the div. I found some question and answer like this but no one gives a clear ...
11
votes
4answers
8k views

Add custom product attribute to checkout summary Magento 2

I am trying to add a custom product attribute to the list of items on the summary section in the checkout in Magento 2. The template file is at Magento_Checkout/web/template/summary/item/details.html ...
0
votes
1answer
1k views

Magento 2 knockout component scope

I have two knockout components. The xml in layout is: <body> <referenceContainer name="content"> <block class="Vendor\Module\Block\List" name="some_name" template="list....
1
vote
1answer
1k views

“Additional Data” in Magento 2 Checkout Order Summary

I have overidden the template: /Magento_Checkout/web/template/summary/item/details.html For each row, if set, I need to display the "additional_data" field. I can get the value for an arbitrary row ...
7
votes
1answer
1k views

how to load or add js before require js in magento 2

I am trying to override default_head_blocks.xml like below vendor\magento\module-theme\view\frontend\layout\default_head_blocks.xml <?xml version="1.0"?> <!-- /** * Copyright © 2016 Magento....
0
votes
1answer
59 views

How to Write Knockout Js Code. Magento 2

I'm trying to Hide 3 Radio Buttons when Checkbox is unchecked when I checked it the all 3 buttons need to show in Jquery the code will be like show_hide_fun: function(){ window....
0
votes
1answer
2k views

Magento 2 knockout Select options not returning the value

I have Created custom component with select drop down when I select an option and alert the select option it spits out : function observable() { if (arguments.length > 0) { ...
2
votes
0answers
104 views

Magento2 : knock out js

I would like to changes in checkout page address fields, how to remove the fields or update, the code is knockout js. How to modify this. <div class="address-information address-info-3-columns"&...
0
votes
1answer
74 views

Magento 2 - Using jQuery on HTML page

I have a custom offline payment module and I am trying to use jQuery to hide a div in frontend/web/template/payment.html: <script> require([ 'jquery' ], function($){ if ( $('#payroll-form'...
2
votes
0answers
31 views

How to update data input on checkout page in magento2 (knockout.js)

On the checkout page in Magento 2 After search data by finder code, it auto fill customers data. But when I click the "Next" button. It will show "This is a required field." In this post https://...
1
vote
1answer
26 views

Set Default Billing Address as Billing Address via knockout on checkout page

The Checkout page is currently loading Shipping address as billing and shipping address. I want to load default billing address on checkbox click and set it to order before save. I dont know how to ...
0
votes
0answers
19 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
1answer
1k views

magento 2 payment method does not show up in checkout page frontend

I'm trying to implement a new payment method with Magento 2 , so i have implemented the below code to display the payment method as an option within payment methods list , however the issue is "...
0
votes
0answers
27 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
30 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
39 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
10 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 ...
1
vote
0answers
24 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
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
1answer
1k views

magento 2 get value of selected select box using knockout in custom module

I have created custom module , in which I have created front end template form using knockout js. In form I have created a select box. I want selected option value in form post method and save that ...
2
votes
2answers
624 views

Get customer chosen shipping method with jQuery

How could i find out the shipping method that the customer has chosen right after click of change? I have tried to get shipping methods id or value that customer has chosen when he/she has clicked ...
19
votes
3answers
13k views

Magento 2: How/Where is the `getTemplate` Knockout Function Bound?

Many Magento backend pages contain the following in their source code <!-- ko template: getTemplate() --><!-- /ko --> I understand (or think I do?) that <!-- ko template is a ...
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
36 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 ...
3
votes
3answers
4k views

Best Way Of Getting Base URL Inside KnockoutJS .html File

How can I get the base URL inside a KnockoutJS HTML file? See file below: app/design/frontend/<Vendor>/<Theme>/Magento_Checkout/web/template/<Filename>.html
0
votes
0answers
20 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 ...
5
votes
1answer
1k views

Magento 2: shipping methods not updated on changing of checkout fields

In the past when I fill one of the checkout fields then shipping method section under the checkout page refreshed and then updated like this: But now shipping method not updated by calling ajax (or ...
1
vote
3answers
1k views

Magento 2 override minicart.phtml in custom module

I'm trying to override minicart.phtml file from Magento2\vendor\magento\module-checkout\view\frontend\templates\cart\minicart.phtml to my custom module Magento2\vendor\XXXX\YYYY\view\frontend\...
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" ...
2
votes
2answers
2k views

Magento2 Knockout js - issue on cart

I tried to reposition my cart block to a other header location. Since then I am getting this javascript error which is annoying since I only repositioned a block. Uncaught TypeError: Unable to ...
2
votes
1answer
89 views

Magento 2.2.5 custom js not working when I call it from phtml file using uiComponent

I have created admin form using uiComponent. I have called phtml file using <htmlContent name="html_content"> in xml file. I tired to call custom.js using below code but its not working. <...
1
vote
4answers
700 views

I want to translate “Buy” and “save” word in tier_price.phtml file. magento 2

I want to translate "Buy" and "Save" word in tier_price.phtml file.I have added the word in translation csv file but it is not working form me. Refer screenshot PATH : vendor/magento/module-...
1
vote
1answer
33 views

Minicart -product_sku in Magento 2

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
0
votes
2answers
681 views

Knockout.js What is the correct way to reference $parent on js file?

I am new on Knockout.js, especially on how to use it in the Magento way. I create a custom ViewModel with a js file called storepickup-select.js and an HTML template called storepickup-select.html. ...
7
votes
1answer
3k views

Magento 2 Add to cart frontend event listener

I am trying to find good solution to execute custom javascript when product is successfully added to cart. Also this custom javascript need information about product that was added to cart (sku, qty, ...
5
votes
1answer
3k views

How is product data passed from a Block to knockout template?

I'm investigating loading some product images via knockout templates. While looking for an example from the core I saw the minicart has this behaviour but right now i don't fully understand how the ...
0
votes
0answers
23 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 ...