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
2answers
171 views

How to show loader on custom checkout page in Magento 2?

I have created some steps in magento 2 on saving the data an ajax is fired. I want to show loader between start and complete process how to i achieve that. My JS file for saving the data is : define( [...
0
votes
0answers
31 views

Payment credit card fields not visible in safari browser in Magento 2.2.5

I'm working on a project in Magento-2.2.5 but on checkout the payment method add cards and other fields does not appear. This issue only occurs in safari browser, in other all browser it works fine. ...
0
votes
2answers
105 views

How to load PHTML file last after page is fully loaded

I have a script in my phtml file but I want to only load this ones the page is fully loaded. I am doing a check if my custom module is enabled show the < script > Adding script like this : You ...
0
votes
0answers
17 views

Onepage checkout processed without payment gateway

One step checkout is processing order success without payment. I have to manually click on payment gateway radio button then click on proceed It's returning me error from payment extension utility.php ...
0
votes
0answers
39 views

Headless without javascript

Recently I was thinking about going headless in order to improve performance of a magento store and also at least in theory faster front-end development and faster deployment. But going headless by ...
0
votes
0answers
16 views

How to add js file for specific product type edit page?

I create new product type in Magento 2. I want add js file for specific type to product edit page. How i do?
1
vote
0answers
125 views

Magento 2 Remove “Choose an Option…” in Configurable Attribute Dropdown Menu

I need to remove "Choose an Option..." from the configurable option dropdown menu on the product pages. I've already checked similar questions here and this one is the closest so far. The ...
0
votes
0answers
39 views

Cannot read property 'init' of undefined

I'm having trouble trying to proceed to the checkout of a Magento 1.9 store. If I am at the checkout and go back to the store, when I go to the checkout again, I can't go any further, because the &...
2
votes
4answers
823 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:...
0
votes
0answers
30 views

i moved magento1 store from one server to another server, it is displaying only half page except for homepage and admin

i moved magento1 store from one server to another server, it is displaying only half page except for homepage and admin, phtml files and cms pages are not loading.
0
votes
0answers
51 views

Uncaught SyntaxError: Unexpected token < in JSON at position 1 - Magento 2.3.5

I upgrade from magento 2.2 to 2.3.5 today, and is encounter the following error, also the checkout page shows nothing but the store header/logo area. ( the shopping cart page is ok), i think the ...
0
votes
0answers
19 views

Only Load required js scripts on particular page

Hi we have a custom theme where i have examined that only 16 js files are required on that page but the magento loads up 298 scripts which slows the home page speed. so i want to know is there a way ...
0
votes
1answer
142 views

How to use Lottie animation library in Magento 2?

we are using Magento V 2.3.5-p1. According to the client's requirements, they want to display animation in some of the pages. for that, they gave us .json file for animation. we have used Lottie js to ...
0
votes
0answers
50 views

Magento 2 JS issue

on my Magento 2 I use Porto latest theme version. Sometimes language and currency drops dont work. I must always restart page to fix. I got following JS error Uncaught SyntaxError: Unexpected end ...
0
votes
0answers
9 views

How to defer parsing js files used via cdn

I am using the Defer Parsing of JavaScript by Meetanshi module, which is a free module from the marketplace. The module has deferred loading of local files, but it has not deferred the files that the ...
2
votes
1answer
125 views

Magento 2 core files missing on cloud

Hi i have encountered a very strange error today in my console log where my js files are missing and this is the error which am getting in the console DevTools failed to load SourceMap: Could not load ...
0
votes
1answer
67 views

How to have loader widget block only some content

The loader widget allows a developer to block page content while an AJAX request is ongoing. The devdocs describes it as: The Loader widget blocks page content (all content or a part of it). I'm ...
0
votes
1answer
13 views

Increase front-end message appearance time

I have the following Javascript code and need to increase the time that these 3 messages are displayed on the Magento2 front-end. Customers cannot see them as they flash. define([ 'Magento_Ui/...
0
votes
1answer
994 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
1answer
47 views

Magento 2.3 - Add Increment qty buttons in the minicart

I try to add increments qty buttons to the minicart. I have add this code: app/design/frontend/theme/name/Magento_Checkout/web/template/minicart/item/default.html <div class="details-qty ...
0
votes
2answers
33 views

how to use js and css in custom module in magento 2.3.5

I want to use css and js in custom module, I want to create collapse tabs in magento so anyone can have idea please share with me. Thank you in advance.
0
votes
2answers
17 views

Static CSS files being generated by JS isn't

I'm using default/Magento_Theme/layout/default_head_blocks.xml to add CSS and JS. In developer mode, CSS is being added to static files but JS and files are not. <?xml version="1.0"?> &...
0
votes
0answers
144 views

Problem with script (map - INPOST ) in checkout - Shipping method

I am trying to add my new shipping method with a map (INPOST) but I have a problem. My map won't load. Then I try to use a case with no map, with points but still not working in the checkout. I tried ...
1
vote
0answers
116 views

How get item in HTMLCollection?

I have code: let fieldset = document.getElementsByClassName('fieldset-wrapper'); console.log(fieldset); in console log: HTMLCollection { length: 0 } when I open collection in console ...
1
vote
0answers
103 views

How to add custom javascript in observer magento2

Im using sales_order_place_before event and want to execute some javascript when my observer executes. public function execute(\Magento\Framework\Event\Observer $observer) { $order = $...
1
vote
1answer
35 views

how add custom javascript file in UI_component?

I have a layout: <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="...
0
votes
0answers
18 views

Change cart qty from onestep checkout

I need to change cart qty via js while on the /checkout page(not in /checkout/cart). Then start the checkout process again with new data. Is this possible?
0
votes
0answers
21 views

Uncaught HeadlessChromium\Exception\JavascriptException: Error during javascript evaluation: TypeError: Cannot read property 'outerHTML' of undefined

All I'm trying with the try catch block in the code below is to let the script run without having it to stop on a fatal error. Exception handling doesn't seem to work since the fatal error displays on ...
2
votes
1answer
155 views

How to Get Base Url in Theme Custom JS file and how to return response in JSON format?

I have created a module in which all the things is done just 2 things are remaining . How to add Dynamic base url in Magento 2 theme JS file. ex : http://127.0.0.1/projectname how to get that ...
1
vote
1answer
91 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
1answer
22 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
18 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
81 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
83 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
24 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
190 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
33 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
38 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
105 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
133 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?
4
votes
0answers
372 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
73 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 ($) { '...
2
votes
0answers
65 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
69 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
35 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
111 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
2answers
444 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
63 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
34 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 ...
0
votes
1answer
322 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 ...

1
3 4
5
6 7
44