26 votes

Getting simple products from configurable

The answers to this question are wrong. Although their implementations might work, it's not the proper way to handle this. The correct way to do this is by using Magentos' service contracts and data ...
Giel Berkers's user avatar
  • 12.2k
17 votes
Accepted

Magento2 get variants of configurable products

Try with $product->getTypeInstance()->getUsedProducts($product).
Marius's user avatar
  • 198k
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
9 votes
Accepted

Magento2 Create simple Product programmatically only works once

Injecting Magento\Catalog\Model\Product in the constructor means, you get the same instance every time (like a singleton). That does not make sense for models. Instead you should inject Magento\...
Fabian Schmengler's user avatar
8 votes
Accepted

Magento 2 - Set simple product Color when creating product programmatically

$attr = $_product->getResource()->getAttribute('color'); $avid = $attr->getSource()->getOptionId('Blue'); //name in Default Store View $_product->setData('color', $avid); I found the answer from here ...
user3748173's user avatar
8 votes
Accepted

Disadvantages for virtual product?

There is no major disadvantage of that. But main concept is if product has a weight then you need to deliver it physically. If product has no weight that means its virtual product (Something which ...
Manthan Dave's user avatar
  • 9,796
8 votes
Accepted

Magento2 - How to see if configurable products has simple products attached

Try below script from magento2 root: <?php error_reporting(E_ALL); ini_set('display_errors', 1); use Magento\Framework\App\Bootstrap; try{ require __DIR__ . '/app/bootstrap.php'; $...
Pratik Oza's user avatar
  • 3,944
8 votes
Accepted

Stop simple product images overriding main product gallery after clicking swatches

By adding the following code to the theme's view.xml the image from the simple product is now added to the product gallery rather than replacing the one associated with the configurable product. <...
SilkSpin's user avatar
  • 182
7 votes
Accepted

Magento 2.3 Saleable stock qty does not equal Global Attribute Qty

Check inventory_reservation: https://github.com/magento-engcom/msi/wiki/Salable-Quantity-Calculation-and-Mechanism-of-Reservations If you don't want to use MSI (and stick to CatalogInventory_* from 2....
dudzio's user avatar
  • 602
6 votes

how to check if a product is a simple product and not a child of a configurable product

Simply I did: (Magento 1.8) if($_product->isConfigurable()) { echo 'config'; }
Sumith Harshan's user avatar
6 votes
Accepted

How to add simple product to cart instead of configurable product in Magento2

So, this is my solution: class Cart { protected $quote; protected $request; protected $configurableproduct; protected $urlinterface; protected $productrepository; public function __construct( \...
ps202's user avatar
  • 160
6 votes
Accepted

Get collection of simple simple products in Magento2

This should do the trick public function getProducts() { /** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */ $collection = $this->_productCollectionFactory->...
Shawn Abramson's user avatar
5 votes

Magento Configurable Product Price Overriding Simple Product Price

Using Magento Version 1.9.2.2 May be slightly better solution, use 'Observer' approach instead of hacking the core or even overriding the default Model Price class i.e. app/code/core/Mage/Catalog/...
Zeeshan's user avatar
  • 51
5 votes
Accepted

How can I stop other attributes changing my swatch image?

Facing with the same problem, today I wrote the following fix, it works both with attribute selectors and configurable swatches. $j(document).ready(function() { if (typeof ConfigurableMediaImages ...
bencergazda's user avatar
5 votes

Get Custom Option Values of a product magento 2

Try this: $_product = $block->getProduct(); foreach ($_product->getOptions() as $o) { if ($o->getTitle() != 'Color') { // or another title of option continue; } foreach ($...
Siarhey Uchukhlebau's user avatar
5 votes

Disallow sell of a simple product but allow that product to be sell in bundled product

Just simple solution for that Just Set that simple Product visibility to Not Visible Individually Hope this will help you and let me know if its not working
Murtuza Zabuawala's user avatar
5 votes

How to get Customizable Options of a simple product in magento 2

First of: don't directly use the Object Manager, but use dependency injection instead. Secondly, for this task you have a Service Contract that's specific for this purpose: the \Magento\Catalog\Api\...
Giel Berkers's user avatar
  • 12.2k
5 votes
Accepted

How to get Customizable Options of a simple product in magento 2

Got the correct answer.. In your phtml page, $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\Framework\Registry')->registry('...
Rita Jose's user avatar
  • 1,842
4 votes

Magento 2 : New Configurable product - selecting existing simple products manually?

There is currently an open issue on github. Interestingly there seems to be other closed issues around this. At the moment i am not sure it is getting elevated to any degree. Maybe because people are ...
Smartie's user avatar
  • 3,230
4 votes
Accepted

How redirect simple products of Configurable product

the code below should work only if the simple products are assigned to only one configurable product. by default, magento allows you to add a simple product to as many configurable products you need. ...
Marius's user avatar
  • 198k
4 votes
Accepted

Best way to assign simple product to configurable

I rembember that there was a module on a client's installation to convert the type of products but it was not really bugproof. If you mean to convert each product into configurable, you will most ...
Christophe Ferreboeuf's user avatar
4 votes
Accepted

How to correctly update product programmatically - Magento 2

After debugging the code and using the suggestion of @David i realized that the problem wasn't the way i used to create products attributes but the i was using the Create method of the Object Manager (...
A. Martz's user avatar
  • 305
4 votes

How to assign simple product images to configurable product in magento 1

Assuming, that the loaded simple product does hold an image you can do it like so (see addImageToMediaGallery()): <?php require_once('app/Mage.php'); umask(0); Mage::app('default'); Mage::app()-&...
Christoph Farnleitner's user avatar
4 votes

Added a product as configurable but is is showing as simple? Can I change it?

The product is Configurable only if it has children, otherwise, it is "converted" into a Simple product. vendor/magento/module-configurable-product/Model/Product/TypeTransitionManager/Plugin/...
Pratik Oza's user avatar
  • 3,944
4 votes

Magento2 which table to store data like configurable product

Main table for products in magento: catalog_product_entity Above table is an act as main table, for that child tables are staring with “catalog_product_entity_” prefix. - ...
Rakesh Donga's user avatar
  • 5,324
4 votes
Accepted

How the Magento 2 Final price calculate for the simple product?

So again you have: Regular price -> 100 Catalog price rule -> 10% Special price -> 80 Tier price when a customer buys 1 item -> 70 (keep in mind that this price is lower than Special price) Tier ...
underser's user avatar
  • 540
3 votes

Magento2 get variants of configurable products

You can get child product of current configurable product by this simple code: $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $product = $objectManager->get('Magento\...
Prince Patel's user avatar
  • 22.6k
3 votes

Filtering status on simple products

In this instead of using Mage::getModel('catalog/product_type_configurable') and getting child product color option. You can use product collection resource model Mage::getResourceModel('catalog/...
Amit Bera's user avatar
  • 77.2k
3 votes

Magento Configurable Product Price Overriding Simple Product Price

Kindly follow the below steps to change the super attribute price First Use observers "catalog_product_get_final_price". Make observers like this : Open your module config.xml and use below code : &...
Chandresh Rana's user avatar

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