alexa-tracking

Magento 2 Get product custom options on list product page

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/5b1a4f2992523352798b456b/magento-2-get-product-custom-options-on-list-product-page
Magento 2 Get product custom options on list product page


Magento2 Get product custom options on product list page


I need to add custom options added to the simple product on product list page.
 
$customOptions = $objectManager->get('Magento\Catalog\Model\Product\Option')->getProductOptionCollection($_product);
print_r($customOptions->getData());
 
the output i am getting for the product which has custom options is
Array
(
[0] => Array
(
[option_id] => 3
[product_id] => 41
[type] => radio
[is_require] => 1
[sku] =>
[max_characters] => 0
[file_extension] =>
[image_size_x] => 0
[image_size_y] => 0
[sort_order] => 1
[default_title] => size
[store_title] =>
[title] => size
[default_price] =>
[default_price_type] =>
[store_price] =>
[store_price_type] =>
[price] =>
[price_type] =>
)
[1] => Array
(
[option_id] => 4
[product_id] => 41
[type] => field
[is_require] => 0
[sku] => size-custom
[max_characters] => 0
[file_extension] =>
[image_size_x] => 0
[image_size_y] => 0
[sort_order] => 2
[default_title] => custom size
[store_title] =>
[title] => custom size
[default_price] => 0.0000
[default_price_type] => fixed
[store_price] =>
[store_price_type] =>
[price] => 0.0000
[price_type] => fixed
)
)
 
 
As you can see i am getting custom options but not the values. can somebody please help. this is on the product list page



Source: how to get value of product custom option magento 2

Hey daniel8115,

One option I would like you to suggest is to take a look at Magento 2 Custom Options extension from ITORIS INC. This extension will allow you to create tooltips for custom options and values.

Below is one of our articles on how to create dependent custom options in Magento 2: https://www.itoris.com/blog/magento-...magento-2.html