Developer forum

Forum » Development » Only show the custom badge if you are a user/group assigned to the discount.

Only show the custom badge if you are a user/group assigned to the discount.

Caro De Weze
Reply

Hi,

I have created a custom badge in Swift based on the sales badge. The custom badge displays the name of the product discount instead of the discount percentage. When I associate this discount percentage with a group/user, the custom badge is only displayed for that specific user/group. Now, if you are not logged in as a user who can see the custom badges and there is a sales badge applied to the product, the sales badge is displayed with the discount percentage, and a custom badge shows the name of the sales badge. Of course, I want only the sales badge to be visible when you are not logged in as a user who has access to the custom badge discount. How can I achieve this? I've added screenshots and my custom code as a zip.

Caro


Replies

 
Davy Capiau
Reply

Updated version:

I have created a custom badge in Swift based on the sales badge. The custom badge displays the name of the product discount instead of the discount percentage:


 

When I associate this discount percentage with a group/user, the custom badge is only displayed for that specific user/group. 

If you are not logged in as a user who can see the custom badges and there is a sales badge applied to the product, the sales badge is displayed with the discount percentage, and a custom badge shows the name of the sales badge:

image

image

Of course, I want only the sales badge to be visible when you are not logged in as a user who has access to the custom badge discount. How can I achieve this? 

 

Custom code in previous comment

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi

I will hand this over to care as this requires a bit of digging and coding.

They will reach out.

BR Nicolai

 

You must be logged in to post in the forum