[SOLVED] How to aim value and not label inside a metabox select field

Hi,

I created a select list in my WooCommerce product. The admin can select which return policy he wants.

In the single product template, I have three dynamic text fields with each return policy (linked to a custom field inside the Metabox setting page)

When I am trying to conditionally display each text based on the value of my select list, I can only use “contains” on the label and not the value.

For example :
my select list is built like this:
choix1: Retour sous 30 jours
choix2: Pas de retour possible
choix3: Echange mais pas remboursement

The Metabox info below the select field is : "Enter each choice per line. You can also set both value and label like red: Red ".

In my dynamic text field, I use the conditional display :
Dynamic Text > {mb_parametres-du-site_politique_de_retour_2} > contains > “choix2” : doesn’t work
Dynamic Text > {mb_parametres-du-site_politique_de_retour_2} > contains > “Pas de retour” : works

I want to be able to make “choix2” work.

Have you an idea?

Thank you!

Hey Joffrey,

please try the :value filter as described in the academy.

So in your case it: {mb_parametres-du-site_politique_de_retour_2:value}.

Let me know if that helped.

Best,

André

1 Like

That’s so cool ! I didn’t know about this feature !

Thank you so much !

@joffreypersia Bricks is pretty cool indeed. :wink: Glad I could help.

1 Like