I have configurable product which is combination of color and size. I have to get total no. of colors for the configurable product on the listing page.
I am able to get all the child products but not getting exact total of available colors.
There are 15 colors and 3 sizes so total child products is 45. I have to get total no. of colors.
Please give me some solution.
Best Answer
You can use help of class
Magento\ConfigurableProduct\Model\Product\Type\Configurable
refer hereTry like this