Log in
Model

Swatch

Magento\Swatches\Model\ResourceModel\Swatch

What it does

This resource model manages database operations for product swatch options in Magento 2.

Developers use this class to save default swatch values for attributes and to clean up swatch data when converting from swatch to dropdown input types.

It directly interacts with the eav_attribute_option_swatch table to persist and remove swatch configurations.

Public Methods

  • saveDefaultSwatchOption()
  • clearSwatchOptionByOptionIdAndType()