Skip Navigation

[Resolved] Condition logic of a custom field

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by izalcoC 1 year, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2602981

Hi, I need help with the condition logic of a custom field. I created a checkbox field to check if the product has a discount. I used [wpv-conditional if="( NOT(empty($(wpcf-checar-si-el-producto-esta-en-promocion))) )"] [/wpv-conditional] to cover the div and not to display the products with the checkbox field unchecked and it was working. And now, it does not seem to work, and I did not find more information about it.

What is the link to your site?
hidden link

#2603223

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Let me review the current settings and check whats going wrong with your setup.

Can you please share admin access details and tell me where exactly you added the conditional statement. Maybe few screenshots will be helpful.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2604427

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now: hidden link

I've adjusted the conditional code within your view as given under:
=> hidden link

[wpv-conditional if="( '[types field='checar-si-el-producto-esta-en-promocion' output='raw'][/types]' eq '1' )" ]
          [wpv-woo-product-image size="medium"]
          <div class="lfpro">[wpv-post-link]</div>
          <div class="lfprice">[wpv-woo-product-price]</div>
          <div class="lfprorange">[types field='lf_price'][/types]([types field='lf_discount_percentage'][/types]) Descuento</div>
          <div class="lf_tag">[types field='lf_discount_percentage'][/types]</div>
          [/wpv-conditional]

The issue was you were checking for not empty value but when there is no promotion set for the product the value saved was 0 with the field "checar-si-el-producto-esta-en-promocion". As there is 0 available the not empty condition becomes true and that is why it was not working.

#2605175

My issue is resolved now. Thank you so much, Minesh!