Questions tagged [javascript]

JavaScript (JS) is a client side script language which allows to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed. By default Magento 1 comes with the prototype.js library and Magento 2 comes with jQuery. Use 'prototype-js' and 'jquery' tags for questions about those libraries.

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

Issue when clean static files in Magento 2

In my Magento 2 site every time I try to clear the static file cache and try to reload the page in the frontend, several errors come out in the JS console, as if there were continuous conflicts ...
1
vote
0answers
8 views

Magento2 blank Checkout Page with JS errors

Since a few months the Checkout Page show blank except of the logo. In the Browser console there are several JS errors. There are a few threads about this error but nothing helped. I did try fixing it ...
1
vote
0answers
16 views

Code Missing Expression or Not Working

I have another post out there, but I am missing something in this code and it's not working. Need a PRO to look at my mickey-mouse script and help me execute it. Site can be located at https://...
0
votes
0answers
21 views

Access JavaScript function in PHTML file

I want to access javascript function in my phtml file on onchange event of select list. I don't want to use click or change event of Jquery. Here's my PHTML code <form method="post" ...
1
vote
0answers
16 views

Magento 2.3.1 Getting JS errror on checkout/#payment Uncaught TypeError: items is not a function

I am getting JS error 'Uncaught TypeError: items is not a function' on checkout/#payment step in browser console. It's slowing down page load. Please check screen shot.
1
vote
0answers
23 views

Solved: Checkout cart components loading weird

we have a serious problem with the cart-view in our shop: https://www.murergrej.dk/checkout/cart/ Problem 1: Not all buttons are clickable anymore. Problem 2: The message "Free shipping" is ...
2
votes
1answer
24 views

PWA for Magento2 - best option now?

We would like to develop a PWA storefront with Nuxt.js. Vue Storefront for Magento 2 doesn't utilize Nuxt.js and it will be many months (or longer) before Vue Storefront Next (the version built with ...
1
vote
0answers
27 views

Magento2 JS override

How to override Plumrocket_CartReservation/js/prcr file in the local module not in theme var config = { map: { '*': { 'prcr': 'Plumrocket_CartReservation/js/prcr', '...
1
vote
1answer
20 views

Is it possible to load data from the server using a HTTP POST request within a Magento Module js file?

Is it possible to load data from the server using an HTTP POST request within a Magento Module js file? File located in app/code/MyVendor/myCustomModule/view/frontend/web/js/mycustom.js Example ...
0
votes
1answer
12 views

How to use reactjs with magento 2?

I want to use reactjs in my magento 2 module for designing or developing PWA. edit:- how to integrate jqery with magento 2
1
vote
3answers
48 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?
1
vote
0answers
20 views

Magento 2 Uncaught TypeError Cannot read property 'done' of undefined

Uncaught TypeError: Cannot read property 'done' of undefined at UiClass.continueToPayPal (paypal-express-abstract.js:80) at HTMLButtonElement.<anonymous> (knockout.js:4245) at ...
0
votes
0answers
7 views

categories link opens with mouseover whereas in mobile menu its works onClick i want a onClick drop down on desktop view as well in side menu

(function (factory) { 'use strict'; if (typeof define === 'function' && define.amd) { define([ 'jquery' ], factory); } else { factory(window.jQuery); } }(function ($) { '...
1
vote
0answers
11 views

Magento2 eslint entire custom code

I've noticed Magento2 has Javascript Coding Standards, in which they reference an eslint config file. Suppose I have an M2 project I'm developing with a large group of folks and I'd like the team to ...
0
votes
0answers
11 views

Magento 2.3.4: How to address "Resources are blocking the first paint of your page. Consider delivering critical JS/CSS inline

Google's web.dev is penalizing the site by displaying this error. Can anyone please suggest what can be done to eliminate these render-blocking resources?
0
votes
1answer
27 views

How to add custom inline javascript to Magento head?

I want to add this javascript to the head of all Product Pages in Magento 2. Problem is, I'm not sure where to begin with that. I know, there's built in Google Analytics settings in Magento 2, however,...
0
votes
1answer
19 views

JS VarienForm in Magento 2

Is there a way to update this code to work with Magento2? I believe VarienForm has been depreciated in Magento2 but I can't find a similar JS constructor to get the object. var AddToCartForm = new ...
0
votes
0answers
8 views

How to rewrite Js widget which doesn't have return $.mage.widgetName

I'm trying to rewrite JS widget using mixin but getting error Uncaught TypeError: base is not a constructor. If at the end of this widget add return $.mage.widgetName, everything works fine. Can I fix ...
0
votes
2answers
24 views

I want to update order status using magento's rest api

I want to use Magento Api for Updating Status of order in Magento 2.3.5 so anyone can guide me from scratch how can i use api. I also want to know in Magento how many default api is there and how to ...
0
votes
0answers
22 views

Magento 2 checkout loader is stuck

I've seen this question a couple of times, but i wasn't able to solve my problem. My checkout page loads fine but the "loader" gif doesn't go away and I can't interact. Usually refreshing ...
1
vote
0answers
13 views

Is it possible to generate a dependency graph of files included via RequireJS?

In Magento 2 lots of JavaScript files are loaded via RequireJS. Those files, themselves, can also require more JavaScript files, and so on. This can make it difficult to determine where a specific .js ...
1
vote
1answer
28 views

Magento 2 - Custom Module JS error

I am trying to add custom js file using my custom module. But getting below error in console. Uncaught ReferenceError: Plyr is not defined DevTools failed to load SourceMap: Could not load content ...
0
votes
1answer
18 views

Javascript error productSidebar.js Magento 2.3.3

i'm using Magento 2.3.3, and in my catalog's console i found this error in pub/static/ there's no a folder named "version.." but if you skip that folder you can find directly "frontend/AtelierVM/.../...
0
votes
0answers
12 views

Magento 2 Add js code only for checkout step 2

I want to add a piece of javascript code only for checkout step 2 (payment page). What I have tried so far? Loaded stepNavigator and checked if this returns true. stepNavigator.isProcessed('payment'...
1
vote
1answer
25 views

call a vendor function in custom module

I'm trying to create a custom module which will have GoogleSheet Import functionality. So I want to call varienImport.postToFrame() this function works when we click on Check Data option in existing ...
0
votes
0answers
11 views

Magento 2.3.4: How to remove unnecessary script?

I tried to bundle the script using some known commands, but still having to much scripts. Help me too boost my site. some of google
0
votes
0answers
12 views

(Magento 2.3.5-p1) “A technical problem with the server created an error” when editing a category description that has links or HTML comments inside

I created a category description with a style element and some ordinary block-level elements like div and ul, and that worked out fine; then I tried to turn some of the text into links, and whether ...
0
votes
1answer
25 views

How to add a required checkbox to checkout page (policy check)

I know that there is basic functionality, but it does not suit me. How to display my template under the form with the link to the privacy-policy page? Or tell me how to do it right. I need a ...
1
vote
4answers
49 views

How to call Function in Javascript Magento2

I want to show alert using function in phtml file as per below but it seems like the function (myfunction) is not calling. <button onclick="myFunction()">Try it</button> <script type="...
2
votes
1answer
60 views

Magento 2 admin Uncaught TypeError: this.linksFieldset(…).visible is not a function

When we edit product from admin then its showing loading continue and also getting this error "Uncaught TypeError: this.linksFieldset(...).visible is not a function" is showing error in console. We ...
0
votes
1answer
14 views

How to add a green border if validation is completed when submitting the form

Magento 2 has basic validation if the field is not valid. How to add custom validation to the checkout page which will add a green border and an inscription that notifies the user of a successful ...
0
votes
2answers
24 views

How to Pass Parameters in JS Magento2

I have created one module where I want to pass Parameters using JS. So I have followed as per below. app/code/namespace/modulename/view/frontend/templates/index.phtml <div class="example-...
0
votes
0answers
35 views

How to remake js code on jquery ui widget

I have a simple code that animates the appearance of a mini-cart modal window. <script type="text/javascript"> require(['jquery'], function($){ $(document).ready(function(){ ...
0
votes
0answers
6 views

How to create admin form and action for edit and delete in magento 2

I am developing one module for post data to be displayed on front-end and all posts can be add,edit,delete by admin. I want to use UI Component for that, so can anyone can have idea about how to ...
0
votes
0answers
14 views

Magento2 language switcher redirect to 404 or random product page

I have a problem with Magento 2. Language switcher only on mobile in production redirect on the random page or in 404
0
votes
0answers
8 views

how to use library js in child module for current module magento 2

question 1:how to use library js in child module for current module Magento 2? question 2: how to check? if(child module not exist) { use library js in current module } else { use library js ...
0
votes
1answer
66 views

Uncaught Error: Mismatched anonymous define() module: function(t,g,u)

I have a fresh installation of Magento but this error is showing on all of the pages.This may be duplicate of some other but I cannot find solution for my problem so asking here. When I trace back it ...
1
vote
0answers
17 views

How to add icons to input fields if the field has not passed validation

I need to add a custom icon to the floor if the field does not pass validation, as in the screenshot. I tried to implement this functionality with ':after' in CSS &._error .control input { ...
0
votes
0answers
14 views

Magento 2.3.4. This JavaScript error “Uncaught TypeError: Cannot set property 'status' of undefined” appears only on the configurable products

This error originates from the line data[l].status = 1,. Could you please someone point out what is wrong with this line? t(n).on("load", function() { **data[l].status = 1,** ...
0
votes
0answers
3 views

simple products dynamics price display base on tier pricing and quantity

Is there any reference that I can follow, so that my magento can update the price base on customer input quantity VS tier pricing. qty 1 = 10 each qty 3 = 8 each qty 10 = 5 each let say I have above ...
0
votes
0answers
6 views

Determine what Javascript is being run to implement a specific feature

I am looking to replicate a specific interactive frontend feature which is running on Magento 1, in Mageneto 2. I have no access to the Magento 1 admin to determine what extension is being used. I ...
0
votes
1answer
23 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/...
0
votes
1answer
33 views

Magento 2 : How to change html/css classes of onepage checkout in custom theme

I'm creating a new theme from scratch, I would like to change the html code of the checkout/#shipping page. However, the template (Magento_Checkout/onpage.phtml) containing the html code that I would ...
0
votes
0answers
28 views

Magento 2.3.4 theme use different logo file for mobile and larger screens

I need to use 2 different logo files, one for mobile and one for desktop view. I have one single custom theme (parent is luma) and I am wondering how to achieve this by using jquery and/or CSS. Is ...
0
votes
0answers
10 views

How to calculate the amount based on the number of elements on the checkout in the sidebar using knockout

In the block Your Order sidebar there is a block with the elements that are in the basket It has 2 fields price and quantity How to add one additional to these two fields, which is responsible for ...
0
votes
2answers
30 views

how to overwrite a JS file in magento?

I want to replace this JS. \vendor\magento\module-catalog\view\base\web\js\price-options.js I did try override by \app\design\frontend\(vendor)\(theme)\Magento_Catalog\view\base\web\js\price-...
0
votes
2answers
22 views

Magento2.3.2 js and css not getting applied on frontend

I have a site in magento 2.3.2. My code is getting fetched from var/view_processed instead of directly from app/code and app/design. See https://prnt.sc/slkvss The css and css also not getting ...
0
votes
0answers
18 views

Magento 2 - How to use Ajax Auto completer?

I'm working on migration from Magento 1.9.* to Magento 2.3.* , in one of my phtml code I have this javascript Ajax.Autocompleter function, as I know this function is not available in Magento 2.3, how ...
0
votes
0answers
17 views

Cannot read property 'version' of undefined error while hard refreshing the page in magento 2

Whenever I am hard-refreshing the page, it displaying the below js error. jquery-ui.js:37 Uncaught TypeError: Cannot read property 'version' of undefined at jquery-ui.js:37 at mixins.js:87 at Array....
0
votes
0answers
14 views

Remove Shipping Step form M2 Checkout

I need to remove the shipping step from the M2 checkout. The shipping info will always be known as we are only going to allow a custom Store collection method. I realise I can disable the shipping ...

1
2 3 4 5
42