Product Custom option table relation with other entity in Magento 2

Product with the custom option available Out of the box in Magento 2. You can add, delete or update custom option of a product using an admin panel or creating a script by programmatically.

You can check the relation for each custom option table with another table in Magento 2.3

catalog_product_option is the primary table to manage Custom Option related data for a product.

4 Replies to “Product Custom option table relation with other entity in Magento 2”

  1. This might help someone else:

    get all product options data for a specific product

    SELECT
    _cpo.product_id,
    _cpo.option_id,
    _cpo.type,
    _cpo.is_require,
    _cpop.price,
    _cpop.price_type,
    _cpot.title,
    _cpotv.sku,
    _cpotp.price,
    _cpott.title AS Description
    FROM catalog_product_option _cpo
    LEFT JOIN catalog_product_option_price _cpop ON (_cpop.option_id = _cpo.option_id )
    LEFT JOIN catalog_product_option_title _cpot ON (_cpot.option_id = _cpo.option_id )
    LEFT JOIN catalog_product_option_type_value _cpotv ON (_cpotv.option_id = _cpo.option_id )
    LEFT JOIN catalog_product_option_type_price _cpotp ON (_cpotp.option_type_id = _cpotv.option_type_id )
    LEFT JOIN catalog_product_option_type_title _cpott ON (_cpott.option_type_id = _cpotv.option_type_id )

    WHERE product_id = 16974;

    Got the gist of it from here:
    https://magento.stackexchange.com/questions/6247/order-item-custom-options

Leave a Reply