Questions tagged [magento2]

General questions about Magento 2, not specific to a minor version. Use this tag to distinguish from Magento 1. If you have issues with a specific version, please use the appropriate 'Magento-2.x' tag instead. Functionalities between Magento 2 minor versions might differ.

Filter by
Sorted by
Tagged with
46
votes
17answers
13k views

Security Patch SUPEE-10570 - Possible issues?

Magento has released a new security patch for M1, and updates for M1 and M2. What issues should I look out for when upgrading or applying this patch? SUPEE-10570 SUPEE-10570, Magento Commerce 1....
31
votes
6answers
68k views

How to get stock quantity of each product in Magento 2

How to get stock quantity of each product in list.phtml in Magento 2 ?
18
votes
7answers
46k views

How to override .phtml files in Magento 2

I want to customize product details page, So it required to override some .phtml files in following locations. So I want to know, how to override .phtml files in vendor\magento\module-catalog\view\...
12
votes
4answers
26k views

Magento 2 - Redirect customer to custom page after login

Which class I should override in order to redirect a customer to a specific page after login? I have tried to set Redirect Customer to Account Dashboard after Logging in in the store configuration ...
10
votes
1answer
6k views

Magento 2 - enable cash on delivery only for specific shipment method

How to, for example, enable cash on delivery payment only when customer selected flat rate shipping method? I cannot find a way doing this in shipment/payment configuration or in cart rules.
8
votes
4answers
25k views

Magento2 : Admin module Image upload code to display form

I have magento2 admin custom module with image upload functionality. I want to upload image from admin. what code should apply for display image field in from, upload image, also image display in edit ...
8
votes
6answers
19k views

Magento 2.3.0 “A technical problem with the server created an error.” When uploading the logo image

I'm using Magento 2.3.0, with php 7.2 version, on a ubuntu os. Everything looks working fine, but when I try to go into Magento backend, Content - Design/Configuration - Header, and I try to upload ...
3
votes
1answer
9k views

Magento 2 - Redirect user to specific page after register

I write an observer to observe the customer_register_success event and run the following codes to do the redirect but failed. Can anyone help? $url = $this->url->getUrl('/'); $observer->...
13
votes
5answers
19k views

To add default filter to grid in Magento2?

I have created one custom module with title & status field attribute in admin grid. Grid collections in module_test_grid_block.xml <arguments> <argument name="id" ...
9
votes
3answers
12k views

Magento 2 - Redirect user to a specific page if not logged in

I need to redirect user to a landing page if not logged in. I find a similar work in this link. Is there a solution for Magento 2?
1
vote
3answers
1k views

Quote id is empty when inserting multiple records into cart in magento2

I am adding product to cart from ajax by passing product id Here is my controller code. use Magento\Framework\Controller\ResultFactory; use Magento\Framework\App\Action\Action; use Magento\...
64
votes
13answers
135k views

How to get Magento 2 base URL?

In Magento 1 Mage::getBaseUrl();, but in Magento 2 I have to pass responsible class object type in constructor. I don’t have the idea which class I have to pass?
62
votes
8answers
41k views

How to use the new repo.magento.com

I've generated a new Magento Connect key per the developer documentation instructions. How am I supposed to use this key? i.e., if I try getting info, I see the following. $ composer info magento/...
72
votes
13answers
29k views

Is Magento ready for PHP 7?

PHP 7 is reaching beta status and lots of testing is going on at the moment. Given that Magento caught up within the last year from "runs only on PHP 5.3" to "fully compatible with PHP 5.6", I would ...
15
votes
5answers
48k views

Magento 2.2.2 : Allowed memory size of 792723456 bytes exhausted (tried to allocate 184320 bytes)

I am working in magento 2.2.2 and when I save product It will display this error. Fatal error: Allowed memory size of 792723456 bytes exhausted (tried to allocate 184320 bytes) in /var/www/html/...
14
votes
4answers
33k views

Add new tab on product detail page Magento 2 [duplicate]

I want to add an extra tab on product detail page just like review tab, It will look like a product question tab. How can I do this? My block file: namespace Example\ProductQuestion\Block; use ...
21
votes
2answers
15k views

Magento 2 - How to add the DateTime UI Component

I want to add new field as datetime in CMS page section while adding new page, I found that magento using UI Component for it, so after digging I could able to add the date field by using below code ...
20
votes
6answers
17k views

Magento 2: send email with Attachment

How to send email with a file attachment.
61
votes
11answers
72k views

'Area code not set' issue in custom CLI commands in Magento 2

I'm getting following error while updating data through CustomerRepositoryInterface [Magento\Framework\Exception\SessionException] Area code not set: Area code must be set before starting a ...
31
votes
4answers
52k views

Magento 2 - Remove and change footer links

I want to remove the default links of the luma layout and add new links. How can I do that?
53
votes
6answers
79k views

How to get value from `core_config_data` table in Magento 2

Magento 1.x use Mage::getStoreConfig('sections/groups/fields') get data on core_config_data table. How to Magento2 get value from core_config_data table ?
13
votes
3answers
17k views

Magento2 - How to stop a product from getting added to cart programmatically?

What I want to do is if my custom attribute is set in quote then i do not want any product to be added in cart. My custom attribute is being set correctly. To stop product from getting added to cart,...
9
votes
2answers
34k views

How to load custom module js file in magento 2?

I have created banner slider module for magento 2. I have called JS file using following ways and its working fine. In block class I created following function public function getBaseJs($fileName){ ...
43
votes
3answers
75k views

Remove block from layout XML in Magento 2

In Magento 1 I could remove a block added by a layout file by adding this in my layout-block <remove ="block_id_here" /> How can I do the same for Magento 2? As a practical exercise, let's say ...
28
votes
1answer
132k views

Magento2: How to load product by id [duplicate]

I got the product collection in my custom template using the following snippet: <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); /** @var \Magento\Catalog\Model\...
19
votes
3answers
15k views

Magento 2: rewrite controller

how can i rewrite a controller (that's actually an action) in Magento 2? I tried, as instructed here like this: I have my own module called Namespace_Module with a di.xml file, that is taken into ...
25
votes
19answers
77k views

CSS and Javascript files are not loading after Magento 2 installation

I've installed Magento 2 on local server successfully using composer but I'm not able to see frontend and admin panel designs. I see plain texts there. While looking at console I see following error. ...
17
votes
2answers
39k views

How to call a PHTML file within a CMS page Magento 2?

Magento 2 I have installed a sample Bannerslider module downloaded from Magestore. When I call bannerslider.phtml into CMS Home Page, it's showing unreliable error on the home page. {{block class=&...
8
votes
6answers
20k views

How to change currency format in Magento 2?

Currently, the price shows like $2.999,00 I want the price to show like $2,999.00 for locale es_MX (Spanish, Mexico) in product pages, anywhere else the currency format is correct. I've tried all ...
9
votes
5answers
36k views

Magento 2 - Get Subcategories of Specific Parent Category

What I'd like to do is grab all of the child categories of a specific parent category. I'm assuming the best way to do this is by using the parent's ID and of those child categories that are returned, ...
4
votes
6answers
7k views

create category programmatically if not exist - magento 2

I have one custom table, that table have a column name category which contains the events category like entertainment, national events. Now I need to create category from the table? note: create ...
79
votes
22answers
92k views

Required parameter 'theme_dir' was not passed

What is the error message: Required parameter 'theme_dir' was not passed Is it related to in Magento 2? And how can this problem be fixed?
46
votes
17answers
74k views

Magento 2: Safe and easiest way to disable Compare products & Wishlist Module

I am building Magento 2.0 only to sell 2 of my products online. The compare products and wishlist module is irrelevant for me. How I safely and easily remove those modules? I dont want to hack the ...
27
votes
4answers
26k views

Magento 2 - Create order using REST API

I need to use the Magento REST API to create an order from a mobile client. In my case, mobile side will implement the payment directly using PayPal SDK. What I need to do is to create an order by ...
27
votes
2answers
15k views

Magento2 translating Javascript (KO) template text

I am trying to add a translation for the text <!-- ko i18n: 'Store credit available' --><!-- /ko --> present in vendor/magento/module-customer-balance/view/frontend/web/template/payment/...
15
votes
3answers
6k views

How to create custom Module Development in magento 2 from Scratch?

How to create Custom Module Development from scratch in magento 2 with following point. 1.How to Create Module 2.How to Install and Upgrade Database 3.How to Create Module,view and Controller ...
47
votes
3answers
14k views

Magento2: what is the basic difference between plugin and preference?

I used both Plugin and Preference in Magento2 tutorial and both are working fine but what is the basic difference between them. Code for plugin: 1.1) Add a plugin declaration into di.xml: <type ...
27
votes
4answers
69k views

Magento 2 - How to get all items in cart?

At checkout page (chekout/cart) I want to edit the checkout button url destination based on cart items (link.phtml). How can I get all items in cart? I want to do this without using the API. Thanks.
30
votes
4answers
42k views

Magento2 -How to get data from system configuration [duplicate]

Fields added through the system.xml and default values populated with config.xml, how do we fetch the data in Magento2
1
vote
4answers
15k views

How to create a custom form for sending email with file attachment in magento 2

How to create a custom form for sending email in Magento 2 Fields are like First name Last name Address City State Zip code Email Phone Product type: checkbox Option like (1) One (2) Two File upload ...
27
votes
5answers
32k views

Magento 2 remove “Estimate shipping costs and tax” from cart

I want to get rid of the "Estimate Shipping costs and Tax" block in the cart. The devdocs tell Disabling a component is the way to go, so I tried the following: <body> <referenceBlock ...
8
votes
1answer
4k views

Magento2: How to include third pary module through composer.json in custom module

I created a custom module, this module depends on thirt party module(tecnickcom/tcpdf), I added this library in my custom module composer.json file { "name": "packagename/mymodule", "description": "N/...
9
votes
6answers
14k views

Configurable product attribute sort order in Dropdown 2.12

The order of the dropdown is not consistent with the order of the attribute itself. Within the attribute size I have it ordered Newborn 0-3 mo and in the dropdown it shows up as 0-3 Newborn the ...
4
votes
3answers
10k views

Magento 2: How to set Max Length for Street Address?

I would like to set Max Length for Customer's Street Address 1 to 50 Characters & Street Address 2 to 100 Characters. Changes will be applied on Frontend only, where we can find Street Address. ...
9
votes
4answers
8k views

How to create admin theme for Magento2

This method works for Magento 1 but not for Magento 2 (version 0.42.0-beta10): http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/admin/using_custom_admin_theme_templates
34
votes
11answers
46k views

Magento 2 - What is the correct way to change default Order Id?

Magento 2. After fresh install the new Order id will be 100000001, 100000002 and so on. What is the correct way to change that increment id so it would be a higher number? For example 155555552, ...
22
votes
7answers
4k views

Can anyone suggest more technical resources for Magento 2?

I was able to find few articles on Magento 2 from http://magenticians.com/ http://www.thienphucvx.com/ If anybody know some other resources can you please share it here? (links, Ebooks, blogs etc)
31
votes
2answers
67k views

How to use jquery library in Magento 2?

I am creating a Magento theme where I need to include jQuery. When I add this <link src="js/jquery-1.7.1.js"/> in head. It is working but Magento javascript functions are not working. How to ...
36
votes
6answers
46k views

Why Magento 2 is extremely slow?

I used Magento 1.9 and it was okay.It wasnt as fast as a simple joomla site but i had many customers with no problem. Now i wanted to upgrade my site to Magento 2,i bought a new host (same as i ...
26
votes
5answers
21k views

Get product attribute in cart in Magento2

I'm trying to grab a product attribute in the cart template. But I just does not work! The attribute is set to Visible on Catalog Pages on Storefront = yes and Used in Product Listing = yes I use a ...

1
2
3 4 5
96