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....
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: {
...
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 ...
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::...
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.
...
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 ...
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]/[...
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\...
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 ...
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-&...
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>
...
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
...
17
votes
Accepted
Magento2 get variants of configurable products
Try with $product->getTypeInstance()->getUsedProducts($product).
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/...
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
...
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
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::...
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:...
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 ...
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 ...
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\...
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' ...
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 ...
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 ...
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 ...
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 ...
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 ...
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\...
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/...
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($...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
configurable-product × 2091magento2 × 651
magento-1.9 × 467
product × 259
simple-product × 200
price × 153
product-attribute × 136
attributes × 120
magento-2.1 × 94
custom-options × 90
swatches × 87
magento-1.7 × 71
cart × 64
magento2.3 × 60
magento-1.8 × 59
addtocart × 57
color-swatches × 53
associate-products × 47
php × 46
import × 46
products × 46
out-of-stock × 44
configurable-swatches × 42
product-images × 39
stock × 38