In a list page of Magento 2, I want to check that @ every product "Is it a child of any grouped product or not?" if yes then I want to change their URL link when I click on add-to-cart it should be redirected to its parent grouped product detail page.
Thank you.
Best Answer
Product relations in Magento is stored in
catalog_product_relation
table.So you can check if the particular simple product has any data present in the table to check if it has any parent product.
If it has any parent product you can get the Product ID of parent to check the parent product is grouped and you can get the respective product page URL.