34 votes
Accepted

Converting virtual products in Magento 2

You can do it only direct in DB. For example with query update catalog_product_entity set type_id = 'simple' where type_id = 'virtual'; But beware, this query converts all virtual products to simple....
KAndy's user avatar
  • 20.8k
33 votes

Magento 2 - Why do SKU not change dynamically in configurable product view page

I wrote the module based on Fabian Schmengler's solution. This works for me on Magento 2.1.3. /app/code/YourVendor/YourModule/view/frontend/requirejs-config.js var config = { config: { ...
nbjohan's user avatar
  • 521
32 votes

Converting virtual products in Magento 2

Maybe this helps somebody who looks it up. If you create product configurations and dont add weight to the generated products they will be virtual. If you add weight they will be simple products. If ...
Cult's user avatar
  • 441
31 votes
Accepted

How to get parent product id in magento 2?

For getting the parent product id in your phtml file, you can call code directly by: $productId = 52; //this is child product id $objectManager = \Magento\Framework\App\ObjectManager::...
Rakesh Jesadiya's user avatar
28 votes
Accepted

Magento2 How to get configurable option and its price?

This code tested on Magento 2.1.4. All you need is in getConfigurableOptions call. 67 - is a test product ID. In my installation that is a configurable product id. Change it to your product id. ...
Konstantin Gerasimov's user avatar
26 votes
Accepted

Mini-Cart displaying Configurable Product Image instead of simple Product Image Magento 2

You have to do setting from admin panel. GO to Admin panel, Stores -> Configuration -> Sales -> Checkout -> Shopping Cart -> Configurable Product Image Set Product Thumbnail itself from ...
Rakesh Jesadiya's user avatar
24 votes
Accepted

How to make auto select first child product of configurable product in magento2?

For Dropdown: Override this file to your theme: vendor/magento/module-configurable-product/view/frontend/web/js/configurable.js your theme file location will be: app/design/frontend/[vendor]/[...
Sukumar Gorai's user avatar
20 votes

How do I check if a product is configurable

From the question it is not clear for which version you want to check still I am adding answer, For M2 you can check like this, if($product->getTypeId() == \Magento\ConfigurableProduct\Model\...
Keyur Shah's user avatar
20 votes

Magento 2 - Cant buy product - "There are no source items with the in stock status"

DO NOT WORRY IF YOU HAVE PRODUCTS OR ORDERS IN YOUR DB, THIS IS SAFE and TESTED. Whenever we will upgrade magento 2.3.X version to magento 2.4.3 at that time Multi Source Inventory Issue happens. To ...
Darshan modi's user avatar
  • 1,031
19 votes
Accepted

How to show the drop down attribute value using getData() method in magento 2?

Instead of getData() you need to use getAttributeText('attribute_code') for dropdown attributes. like $_product->getAttributeText('material'); For multi-select try this : $result = $_product-&...
Ashish Jagnani's user avatar
19 votes
Accepted

Hide Configurable product images from details page when color swatch is selected

Try to use etc/view.xml file in your theme, with this configuration: <vars module="Magento_ConfigurableProduct"> <var name="gallery_switch_strategy">replace</var> </vars> ...
lpFranz's user avatar
  • 689
18 votes
Accepted

what is difference between catalog_product_super_link and catalog_product_relation table?

catalog_product_super_link table save only Configurable products and its child products relationShip. Where catalog_product_relation save configurable products and its child products relationship ...
Amit Bera's user avatar
  • 77.2k
17 votes
Accepted

Magento2 get variants of configurable products

Try with $product->getTypeInstance()->getUsedProducts($product).
Marius's user avatar
  • 198k
17 votes
Accepted

How Magento getting configurable product lowest price of associated products?

You have to make plugin for that to display max price inside detail page, Below is step by step module for your need, Filepath, app/code/Vendor/Modulename/ Registration file, app/code/Vendor/...
Rakesh Jesadiya's user avatar
17 votes

Magento 2 display old price AND special price in category list

Found solution here : https://github.com/magento/magento2/issues/7624 Copy final_price.phtml from Vendor/magento/module-configurable-product/view/base/templates/product/price/final_price.phtml to ...
cap340's user avatar
  • 701
16 votes
Accepted

While creating configure product it's associate product are virtual instead of simple

You do not set the weight before generation of children's products. Depending on this field the Magento decides what type of product is created
KAndy's user avatar
  • 20.8k
16 votes
Accepted

Magento 2 - Why do SKU not change dynamically in configurable product view page

I did that once for Magento 2.0, don't have the code available but can show you where you need to make changes: Write a Plugin for Magento\ConfigurableProduct\Block\Product\View\Type\Configurable::...
Fabian Schmengler's user avatar
16 votes
Accepted

Magento 2 display configurable Price Range in product listing

You need to pluginize getProductPrice method. SR/Stackexchange/etc/frontend/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
Sohel Rana's user avatar
  • 35.6k
15 votes

Attribute with this code is not super in row - magento 2

Two Points you need to check for this: Scope of attribute is Global. It should be assigned to Attribute Set. Hope this solved the error. (For my case i missed Point 2, Now it is imported ...
Suyash Kumar Bharti's user avatar
14 votes

How to get parent product id in magento 2?

You can call it's in block file, Magento specific way by, protected $_catalogProductTypeConfigurable; public function __construct( \Magento\Catalog\Block\Product\Context $context, //for ...
Rakesh Jesadiya's user avatar
14 votes
Accepted

how to get product thumbnail and product url in order confirmation email

you have to load product to get thumbnail and url . <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->create('Magento\Catalog\Model\...
Qaisar Satti's user avatar
  • 32.4k
14 votes
Accepted

Magento2 custom attribute for specific product type

Yes , You can create specific attribute for specific product type programmatically. Below i have created Boolean type of attribute for configurable product only. You need to pass 'apply_to' ...
Manthan Dave's user avatar
  • 9,796
14 votes
Accepted

Change order of configuration options in customer product view

The position of the attributes of Configurable Product are stored at catalog_product_super_attribute Use SQL to update position in PDP 192 = Id attribute Size 193 = Id Attribute Color update ...
HoangHieu's user avatar
  • 1,348
13 votes

Magento 2: new attribute not showing in list configurable product

If you want to use an Attribute for Configurations, you have to make sure, that it has the Scope Global. That is (I think) like this, because it does not make sense to override a configuration ...
David Verholen's user avatar
13 votes
Accepted

How can I assign an existing simple product to a configurable product using the admin interface?

In Magento 2 you need to first use the Create configurations tool to create the simple products to associate, then you need to replace the auto-generated versions with the simple products you actually ...
MageX's user avatar
  • 580
12 votes

Execute JavaScript code after swatches are displayed in category view

I used the event 'swatch.initialized' to fire a function after swatches are loaded in the product page: $(document).on('swatch.initialized', function() { // do something }) The event is triggered ...
Guillem Lorman's user avatar
12 votes

magento 2 : which tables is used while creating configurable product

Configurable products manage by below tables catalog_product_super_attribute : holds the configurable attributes. catalog_product_super_attribute_label : holds the store view labels for the ...
Suresh Chikani's user avatar
12 votes
Accepted

Magento 2 - How to change Product Name dynamically in configurable product view page

You can try below custom module and modify according to your requirement. app/code/Anshu/SCdata/registration.php <?php \Magento\Framework\Component\ComponentRegistrar::register( \Magento\...
Anshu Mishra's user avatar
  • 8,910
12 votes

Magento 2.2.6 Configurable Product How to Show Old Price and Special Price?

Found solution Here Copy final_price.phtml from Vendor/magento/module-configurable-product/view/base/templates/product/price/final_price.phtml to Vendor/theme/Magento_ConfigurableProduct/templates/...
Ronak Rathod's user avatar
  • 6,259
11 votes
Accepted

PHP Fatal error - Call to undefined method Magento\\Catalog\\Model\\Product\\Type\\Simple::getConfigurableAttributeCollection()

I had the same problem and when I changed $objectManager->get('\Magento\Catalog\Model\Product')->load($productId) into $objectManager->create('\Magento\Catalog\Model\Product')->load($...
Zsolti's user avatar
  • 746

Only top scored, non community-wiki answers of a minimum length are eligible