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
0answers
9 views

Edit/modify Google Analytics code from core module, not working - Magento 2.4.1

I want to edit the default Google Analytics code from the core module Magento_GoogleAnalytics, that is build in Magento 2.4.1. I want to add the line; setTimeout("ga('send','event','Profitable ...
1
vote
1answer
15 views

How to add configurable external JS with data- attributes in Magento 2?

I want to add external JavaScript library in my module. It looks something like below script code <script src="<?php echo $block->escapeUrl($block->getJsLibUrl());?>" data-...
2
votes
0answers
27 views

It is possible to deploy only one file using deploy command?

In production mode when I change the design of some particular block or page then I am only working on one or two files like js and CSS. To apply that one change I need to deploy the whole theme. Can ...
0
votes
0answers
4 views

Magento 2.2.4 - checkout/cart get shipping rates via AJAX

Version 2.2.4 seems to have a buggy form post on checkout/cart to update shipping rates. I have other stores using 2.3.* that work fine. I am trying to run defaultProcessor.getRates() on a JavaScript ...
2
votes
0answers
15 views

Magento 2 How to remove Field required validation, if form Div is Hidden

Magento 2 How to remove --data-mage-init='{"validation":{}}-- when div is hidden, I hide div when select box value is not equal to 0 using Script <div class="row"> <...
0
votes
1answer
32 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
1answer
10 views

How I can make Magento 2 product-info-main sticky like cart sidebar when scroll to down?

I want to make an upper bar as in https://www.atma.com.ar/molinillo-electrico-atma-mc8141n.html that contains the product info and the "add-to-cart" button, and that appears only when I ...
0
votes
0answers
32 views

How to add show/hide link for fields?

Question from new in Magento. I have configurable product (magento2.4) and I need to add show/hide link or button on product page which hides field 1 (input) and shows field 2 (input) and on next ...
0
votes
0answers
11 views

Smart search button [closed]

to cart according to add to cart button its functionality is not working. please guide me with suitable codes. <div class="c-smartsearch__description col-7-8 last">' + ...
2
votes
1answer
32 views

Magento 2.4 deploy command does not creating minify file when I am in production mode

Magento 2.4.0: The static content deployment command does not create minify file when I am in production mode. Getting error on below file. It's not creating so Magento cannot read it. pub/static/...
1
vote
1answer
24 views

Magento 2 Console Error Uncaught TypeError

I have Update Magento version 2.3.4 to 2.4 and now on the product page these errors are coming. Uncaught TypeError: Cannot set property 'migrateVersion' of undefined Uncaught TypeError: Cannot set ...
0
votes
1answer
14 views

Notice: Array to string conversion in shipping delivery on magento 2

I upgraded from magento 2.2.2 to 2.2.11 since I have an error when selecting a shipping address. I get the error: "Notice: Array to string conversion in mywebsite/vendor/magento/framework/DB/...
0
votes
0answers
33 views

Uncaught TypeError: Cannot read property 'offset' of undefined JAVASCRIPT

PLEASE HELP ME GUYS I try to Smooth Auto-Scroll to Next Panel via Mouse Wheel but get some error anyone plz help me how to fix it ''''''''''''''''''''''''''''''' my code function scrollThere(...
3
votes
1answer
34 views

How to add custom js file before body tag in magento 2?

But script moving to inside body tag how to fixes this issue? Anyone can help me for this <referenceContainer name="head.additional"> <block class="Magento\Framework\View\...
1
vote
1answer
188 views

How to call javascript function from Observer file in Magento 2

I have created a custom js file in my custom module. app\code\Vendor\Module\view\frontend\layout\default.xml <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/...
0
votes
0answers
7 views

How can I get the type of the selected associated product in a configurable product in Javascript?

I got a configurable product with these options: Download (Downloadable product type) CD (Simple product type) How can I get the product type of the selected associated product in Javascript?
0
votes
0answers
12 views

Magento2 add cart value change the QTY instead of updating

Currently the default behaviour is if i have item X in the cart with qty 5, if i put 8 in the qty box and add to cart the new qty is 13 - the expected behaviour we need to for the cart to change to 8 ...
0
votes
0answers
30 views

Calling PHP block or Controller from AJAX from just a .JS file in Magento2

In other magento2 modules i have used AJAX to call a block from a PHTML file but for this specific task i am needing to make an ajax call to a controller file from a .js file but i am getting 404 on ...
0
votes
0answers
18 views

How to write magento javascript mixin for widget returned as an object?

I need to write magento javascript mixin for the menu.js part which is returned as the object of two multiple widgets. Actual location of the file is lib\web\mage\menu.js which further extends the ...
1
vote
0answers
30 views

Can't close accordion after update from 2.3.1 to 2.3.5-p1

tl;dr After upgrading from Magento 2.3.1 to Magento 2.3.5-p1 our custom JavaScript, part of our custom theme, stopped working. I'm receiving the following error when trying to close the accordion ...
0
votes
0answers
8 views

Magento 2 - how to use my css and js in the theme and in the components

I'm new with Magento. I'm a rails developer and vue developer with frontend experience, and I have to work on a magento theme (it's a store of a friend of mine) I read a lot of documents and I ...
0
votes
0answers
26 views

Magento 2.4: How can we remove datepicker.js in Magento 2.4

How do I remove datepicker.js?? I have tried in layout "default_head_blocks.xml" ```<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See ...
0
votes
0answers
10 views

checkout shipping page add custom field in magento 2.3.5

Now i added custom field checkout shipping page but issue add custom module custom.js and define layout checkout_index_index.xml but it's not working checkout_index_index.xml <page xmlns:xsi=&...
0
votes
1answer
18 views

Remove JS files from beeing loaded through require-js

I am optimizing the page speed of my Magento 2 frontend. Everything is logically so far... CSS files can be removed through XML, everything should be minified, lazy loaded and so on. BUT: The size of ...
1
vote
1answer
23 views

Need clarification regarding JS merging and JS bundling in magento 2.3.2

I need to understand about JS merging, JS bundling and minify JS for site performance Do we need to enable only one option from JS bundling and JS merging? When i enable Js merging, my listing page ...
0
votes
0answers
24 views

Success/error Messages not closing after 2.3.5 update

Thanks for reading. I've been working on a Magento2 project for the past couple months. Recently we updated from 2.3.0(or 2.3.1, I can't remember) to 2.3.5. Sadly, this caused more bad than good. ...
0
votes
0answers
7 views

Step By Step Testimonial Wizard Using jQuery and CSS | Multi Step Progress Wizard

I am trying to be something like this but there are some issues coming in it, can you help me to fulfill this. Error Link https://prnt.sc/um895k My jQuery code jQuery(document).ready(function(){ $(&...
0
votes
0answers
21 views

Magento2 Uncaught ReferenceError: requirejs is not defined and require.js net::ERR_ABORTED 404 (Not Found)

when the mode is production then it is generating require.min.js when the mode is development it is generating require.js The website is now production mode but it is fetching require.js(but file is ...
0
votes
0answers
15 views

Magento 2 Admin Extension Button Not Showing Javascript

We have Latest Mirasvit Advance Feeds extension installed on our Magento 2.2.2. site PHP 7.1 - all the features of the extension are loading fine apart from the + button in the category mapping ...
0
votes
0answers
13 views

Remove all js magento 2 default

i wanna to create Custom Theme without JS magento 2 default. When I enable the require-js functionality magento keeps loading all the default JS files. can you help me handle my problem? thank you so ...
0
votes
0answers
20 views

Please enter a value between NaN and NaN Magento 2

I added a range price slider to my product checkout. Now adding the product works fine. So basically I have a Select input where it contains a dropdown of the price value but I hidden it and made the ...
0
votes
1answer
64 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
15 views

How to prevent from always static content deploy content on changing JS and CSS work in Magento 2?

How to prevent from static content deploy after changing in JS or CSS file in Magento 2. After doing some little change changes are not loads in front end if doesn't deploy. How to do that Any help is ...
0
votes
0answers
16 views

Magento 2.3 How to apply coupon code discount on regular price

When I apply a coupon code on the cart, it gives a discount on the final price if a special price is set. But I want to apply a discount on a regular price ( If a special price is set on that product) ...
0
votes
0answers
18 views

Download or save page as HTML on Button click

I want to download or save the page as an HTML when someone clicks on the Download button or link. Please check the below code. <button class='download'>Download</button> <a href='#' ...
0
votes
0answers
12 views

Fixed Layered Navigation

I am building a layered navigation module for my theme based off magento 2 blank. I noticed there is no mobile friendly version of the layered navigation included in this theme. I have hidden the ...
0
votes
1answer
17 views

New js in Magento_Checkout into custom theme

Is it possible to create a new js file here or do I need to create a new component?
0
votes
0answers
10 views

Error 400 while trying to POST to orders

When I try to create an order, I get the error 400, can someone help me? Things that may help you guys help me I'm using NodeJS with Express Data that I'm trying to post { "entity&...
0
votes
1answer
77 views

Magento 2 - How to add custom JS file path into CMS Block

How to get JS file in the blocks, How to declare like: <script type="text/javascript"> src="{{skin url=''}}js/my_custom.js"> </script> My JS path: app/design/...
-1
votes
3answers
63 views

How to get Base URL in magento 2 admin script?

I Have added a script ( JS File ) in Magento 2 admin side in my custom module. It added successfully but how to get Base URL in admin side js file. I have tried this Js file path ( app/code/Tym17/...
0
votes
0answers
17 views

Magento 2.2.5 errors in Safari browser

we have integrated one step checkout. it's working fine in other browsers but in safari it's throwing error, because of that credit card form is not visible on checkout page. above is the error i'm ...
0
votes
1answer
18 views

How to add js right before head tag end

I want to add js EXACTLY right before end of head tag I've try this solution, but it only put the js to middle of the head tag, not right before end of head tag https://magento.stackexchange.com/a/...
0
votes
0answers
24 views

Multiple wishlist mixin for mage.promptEditWithList is broken

I have created a mixin to extend the mage.promptEditWithList widget in /vendor/magento/module-multiple-wishlist/view/frontend/web/js/multiple-wishlist.js, but it breaks the edit wishlist functionality ...
0
votes
2answers
51 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
22 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
24 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
14 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
18 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
15 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?
0
votes
0answers
25 views

Magento 2.3 checkout JS Components will not be loaded

I faced the list of these errors on my checkout cart page. Order summary details are also missing. If I'm activating the default theme (Luma) then working correctly. Kindly Guide me to rectify this ...

1
2 3 4 5
43