Wildcard27
Wildcard27

Reputation: 1459

Getting configurable product options showing in Magento related products list

A the title suggests, I am trying to get configurable product options to show for products in the upsell and related products lists on the product view page.

So far, Google has come up empty handed so am turning to you, the Magento pro community, for assistance.

I don't have much of a list of things I have tried as I have no idea where to start. However, I have copied over the vendor/magento/module-catalog/view/frontend/templates/product/list/items.phtml file into my own theme, turned on the 'add to cart' buttons and played around a little.

Using Magento 2.1.7

Upvotes: 1

Views: 869

Answers (1)

Anoxy
Anoxy

Reputation: 953

You should be able to use your configurable product object to fetch the used products by that configurable product and through there get the options. You can get used products with the following snippet.

$_children = $_product->getTypeInstance()->getUsedProducts($_product)

Upvotes: 1

Related Questions