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.

catalog_product_option table diagram
                      catalog_product_option table relation to other entity diagram

— add an entry for each type of custom option like dropdown, radio, text field etc…
— add each type separate value with option_id from a catalog_product_option table and manage sort order of option and separate SKU of each item option
— Store the title of Option Main title
— store the subtitle of each option specific to store id
— add each option price for field value except dropdown, radio,multi-select, and checkbox if the option has assigned extra price with respect to catalog_product_option’s option_id and store id value with an input type field
— add the price of the dropdown, radio,multi-select and check box option to the above table

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

    _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:

Leave a Reply