Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

Filter by
Sorted by
Tagged with
1
vote
1answer
96 views

Cart summary_count not updated when “add to cart” is pressed

I'm using the following code to show the total number of items in a users cart: <span data-bind="text: JSON.parse(window.localStorage.getItem('mage-cache-storage')).cart.summary_count">...
0
votes
0answers
38 views

How to reload a component on checkout page when shipping address is modified

I am using Amasty Deliverydate module, this module allows customer to select delivery date and time on checkout step. I am trying to customize this module and we have developed a feature where admin ...
3
votes
0answers
57 views

Magento2 Holepunch Cache for Pricing

I have a Magento 2 website which has been set up to allow customers to have their own pricing. However, as a result of this the FPC (for category and product pages) is now being generated uniquely for ...
0
votes
1answer
184 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. ...
0
votes
0answers
164 views

How to display cart item count in custom header using JavaScript?

I've created a custom header that works fine. I replaced Magento's cart, and instead added a shopping basket icon in the header. Like so: When pressed it redirects to the cart. What I want to do is ...
0
votes
2answers
136 views

How To Pass data from Helper Data to Knockout JS file Magento 2

How i can pass helper data to Knockout JS to show it on my html file. Actually i am working on minicart and i want to show the product Qty as Dropdown and get value from Helperdata. Any help would be ...
0
votes
0answers
19 views

How to hide special price based on a checkbox?

Some people want the ability to hide special price and only show retail price. I want to do this in knockout by adding a class to the parent container. This class will be set based on a cookie that is ...
0
votes
0answers
10 views

Magento2.4 use knockout to identify if user is logged in

I am trying to edit the links in the header.phtml file so that it will show and additional link only if logged in. My issue is it does not seem to work here is my code. The sign up is showing even ...
0
votes
1answer
292 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 ...
3
votes
2answers
135 views

Magento 2 - How does getShippingMethodTitle know the method title in module-tax/view/frontend/web/js/view/checkout/cart/totals/shipping.js

I try to understand knockoutjs and requirejs more but I fail to understand the following case. In checkout the shipping method title is showing in the summary This is the template: vendor/magento/...
0
votes
1answer
24 views

Magento 2 - Pass data to checkout during runtime

I created a new carrier method for express shipping. I need to show a dynamic message which I am generating based on the products in the cart. There are some product categories which are not allowed ...
0
votes
1answer
357 views

Magento 2 - how to add methods to a javascript file by using mixins?

I am using the extension amasty/single-step-checkout. They are using this mixin... vendor\amasty\module-single-step-checkout\view\frontend\web\js\view\shipping-mixin.js (A) ...to extend this magento ...
0
votes
2answers
110 views

Magento 2: Translate knockout template html text with variables

Currently i have a knockout template for minicart like this: <!-- ko if: getCartParam('summary_count') --> <div class="items-total"> <!-- ko if: getCartParam('...
1
vote
1answer
48 views

Magento 2 - How to override frontend javascript file

I need to overwrite a javascript file from a custom module at: vendor\amasty\module-single-step-checkout\view\frontend\web\js\model\one-step-layout.js because I need to replace a code line in it to ...
0
votes
0answers
25 views

Magento 2.3.4 Region Missing When Creating a New Address During Checkout

Running into an issue during checkout on the Shipping step. When you add a new address to ship to during this step, it asks you for your City, State, Zip... however after adding your address, the ...
0
votes
0answers
18 views

Magento 2 Uncaught TypeError: Cannot read property 'confirmation' of undefined in datapost.js

I get this error while using a<> tag with attribute data-post. I used a data-post to re-order. history.phtml <a data-post="value: postData" href="#">Reorder</a> ...
0
votes
2answers
119 views

Uncaught TypeError: Unable to process binding “html: function(){return getInstructions() }” ( Magento 2 )

I'm using a third party one page checkout module on this system. And added an observer "payment_method_is_active" event for the cash on delivery and bank transfer methods to enable them only ...
0
votes
1answer
193 views

Magento 2 - override knockoutjs template located in base folder

I need to change the value of the maxinput field in the knockoutjs template vendor\magento\module-ui\view\base\web\templates\form\element\input.html so I have to replace the template with my own ...
0
votes
1answer
91 views

Magento 2: Adding a color picker as an attribute to a product form

Please tell me how you can add a color picker as an attribute to the product form. I tried several options from the Internet, well, they did not work.
0
votes
0answers
64 views

Magento 2.3.5: custom item renderer for checkout review step (access template view model from within uiComponent)

I'm trying to build a custom item renderer intended to gather all configurable child items for an "user-friendlier" display. I finally did it for cart and minicart contexts, but I'm ...
0
votes
0answers
15 views

Magento 2 Checkout shipping afterRender

how to add afterRende to a form (page checkout shipping).I am using setInterval to check form is loaded, but it's a very bad idea.
0
votes
0answers
38 views

how to add quantity increment and decreament (+ and - button) in cart summary magento 2?

I want to add increment decrement functionality in the checkout page how to achieve this
0
votes
1answer
777 views

Magento 2 - How to get quote shipping method in knockout js?

In Magento 2 I try to get shipping method in this js file : vendor/magento/module-checkout/view/frontend/web/template/billing-address.html I try this : quote.shippingMethod()['method_code']; And I ...
0
votes
1answer
33 views

magento 2.3.3 konckout translation doesn't work

Hello I have the official stripe module for magento 2 which is not trasnlated correctly. This is the piece of code: <span><!-- ko i18n: 'Use a new card'--><!-- /ko --></span&...
0
votes
0answers
102 views

Check if default billing address in checkout - Magento 2.3

Inside the checkout /app/design/theme/theme/Magento_Checkout/view/frontend/web/template/shipping.html file I would like to check if the customer does have a default billing address. Is there a ...
0
votes
0answers
21 views

Magento 2 need to add new component Form on checkout step shipping which appear on selected shipping Method

I have some issue to add a new form on shipping checkout step . Form visibilty depends of the selected shipping method. and on submitting shipping steps my form should be submitting and my data should ...
0
votes
2answers
26 views

Magento 2 - Where are data-bind attributes defined?

In the file vendor\magento\module-checkout\view\frontend\web\template\minicart\item\default.html there is this code: <li class="item product product-item" data-role="product-item&...
0
votes
0answers
49 views

Knockout Js not found Magento 2.3

I am unable to click on menus, submenu in admin Panel. I have checked and found there are errors related to knockout.js in console panel. Front-end is working fine but i can see the same knockout ...
0
votes
1answer
344 views

Magento 2 - get amount of items in cart by using knockout.js

I am creating a new header. It is supposed to look like this: I need to get the number of items in the cart and write it to a certain place in the header, where the minicart is showing. So I added ...
2
votes
0answers
41 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'"> ...
1
vote
3answers
172 views

Magento 2 - How to override knockoutjs template?

I try to override the following template from my own module vendor\magento\module-checkout\view\frontend\web\template\minicart\item\default.html but I don't find the file where I can override it, I ...
2
votes
4answers
714 views

How to load js file first in Magento 2

I'm using Magento 2 and I have a js file that was called like this: default.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
3
votes
1answer
283 views

Add custom knockout component to checkout sidebar in Magento 2

I'd like to know what is the best approach to add a custom knockout component to the checkout sidebar in Magento 2, an example assuming we already have a custom module would be great UPDATE: As I ...
1
vote
0answers
30 views

How can I remove Recently Viewed Products individually using delete(icon) button?

I want to add a delete button link to the recently viewed products and when we click on delete button link of any product then it should be remove from the list. You can see image for better ...
1
vote
0answers
15 views

How to pass data using chackboxes in HTML uiComponent

I'm trying to add/remove data based on a checkbox. I can't figure out how go get the value to get through to the function. My console is logging a list of my observed variables. Any idea how to pass ...
0
votes
2answers
748 views

How to implement jQuery click event in magento knockout JS function

how to implement below jQuery code into knockout js, Actually I'm trying to call this function on a button click event using knockout js, but it's not working HTML code: <div> <ul class=&...
0
votes
1answer
110 views

Mini cart js is not working properly the count is not showing some times

Minicart is not showing cart count properly at the time of not logging in. I had tried to show statically into the id condition but the when loading the 0 is shown after load it is not showing, I ...
1
vote
0answers
64 views

Magento 2: How to make new billing address form shows up in popup in checkout just like new shipping address form?

In magento 2 checkout page there will be a pop up form when we add new address instead of using current shipping address, but for billing address the new billing address form is below the dropdown, is ...
0
votes
1answer
859 views

Magento 2.3.4: Refresh window.checkoutConfig

We are adding shipping price of quote object to myTestData which is pulled onto the page using window.checkoutConfig.myTestData: use Magento\Checkout\Model\ConfigProviderInterface; class Config ...
0
votes
0answers
72 views

Jquery callback function cannot read property of undefined using knockout js

1.lets assume placeOrderClick function is called.within this there is a eprotect API success callback function called submitAfterEprotect. i'm trying to call placeorder function using self in ...
0
votes
1answer
26 views

Magento 2: How to translate knockout html file for word that contains hyperlink?

I have a text like this: To contact us please email us at joe@mail.com, will be waiting! when the user clicked on the email it will redirect the user to mail link, using phtml i can easily achieve it ...
2
votes
1answer
528 views

Uncaught TypeError: Cannot read property 'status' of undefined misc.js:181 checkout shipping page Magento 2.3.5

I am facing below console error in our site so that some of our extension stopped working in checkout shipping page Magento 2.3.5 pub/static/frontend/Vendor/Theme/en_GB/mage/utils/misc.js define([ ...
2
votes
1answer
182 views

Wishlist not working for login customer in magento2 with caching if once i add product then wishlist icon remove by KO wishlist().counter?

How can I set my wishlist for logged on customer and log gout customer with knockout JS if I logged on then I only add product once then wishlist icon remove because of knockout JS how to write ...
1
vote
1answer
124 views

Magento 2: how to get product details using Magento_Checkout/js/model/quote

In Magento 2 how we can get the product details using Magento_Checkout/js/model/quote
2
votes
0answers
26 views

Magento 2: How to bind an element in phtml with minicart js model function?

I want to print the items count in somewhere else, so i create a new phtml like this: <?php /** @var $block \Magento\Checkout\Block\Cart\Sidebar */ ?> <div class="test-cart" data-...
1
vote
0answers
23 views

Magento 2 - Save data of customer from a form in database

I wish I could create a form with several inputs dedicated to the customer's attributes in my first custom checkout step. This form will have to save the data in the database, in the customer ...
2
votes
0answers
16 views

Magento 2.3.4: Not able to search admin grids

Recently upgraded from 2.3.1 to 2.3.4-p2 and now we're not able to use the keyword search above admin grids like Catalog > Products, Sales > Orders, etc. We can still use the filter boxes, but ...
1
vote
3answers
116 views

How to get store logo url in Javascript file in Magento 2?

I want to load store logo image URL in javascript so i can bind it to my knockout element, how can i achieve that?
0
votes
0answers
29 views

Magento 2 - Create repeatable field in checkout and saving the data to model

I am trying to create fields for each product in the cart. Some extra data needs to be filled in per product and the wish was for it to be found in the address section of the checkout form. I can ...
1
vote
0answers
14 views

How to initiate tabs widget when all payment methods are rendered

I want to initialize tabs widget on payment methods on checkout. How would I know if all the payment methods are rendered and it is now safe to initialize tabs. Thanks

1
2
3 4 5
15