$groupId = Shop::getContextShopGroupID(); echo "The current shop belongs to group ID: " . $groupId;
if (Shop::getContextShopGroupID() == 5) { // Apply a discount to all products in this shop // because it belongs to group #5 }Here, we use the getContextShopGroupID function in an if statement to execute some code only if the current shop belongs to group #5. This allows us to apply a discount only to certain groups of shops. This function is part of the PrestaShop framework, which is a package library for building e-commerce websites.