daniel8115Avatar border
TS
daniel8115
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

0
1.4K
1
GuestAvatar border
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Urutan
Terbaru
Terlama
GuestAvatar border
Guest
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Komunitas Pilihan