Magento 2 category id from product id

MariaDB [magento]> select * from catalog_category_product where product_id=2047 limit 10;
+———–+————-+————+———-+
| entity_id | category_id | product_id | position |
+———–+————-+————+———-+
| 5178 | 3 | 2047 | 0 |
| 5179 | 4 | 2047 | 0 |
+———–+————-+————+———-+
2 rows in set (0.00 sec)

Leave a Reply

Your email address will not be published. Required fields are marked *