where the products belong to multiple categories, it is going to problematic to set the discount based on the category.
a simpler approach would be to mark the items as discounted directly in the products table.
you will need to create a discounted column in the products table and set it to 0 for items that should not be discounted and 1 for items that should be discounted.
use this column in the add to cart button instead.