Conditional Logic & Layout Problem

Hi,

I have an overlay containing a modal hidden behind a Woocommerce featured image in a Pro Layout, which I only want to display if certain conditions are met. However, I am having difficulty in getting the logic right.

I have used an ACF field with a simple checkbox and single response “Yes”, which is available on all Products. The field is not mandatory.

What I want is that if the checkbox is ticked, the value “Yes” is provided. The overlay’s modal has the condition set that if the checkbox is checked it will show the modal; if not ticked, the modal remains hidden.

A secondary and minor problem is that the modal’s toggle seems to grip to the right-hand edge of the featured image. I have set flex to be center center, but the toggle will not center!

Any help will be gratefully received,
Christopher

Hi Christopher,

Thank you for writing in, where is this field {{dc:acf:post_field field="field_609c18d821111"}} coming from? I don’t see it on the ACF. I saw the coming_soon, if so, your condition should be:

{{dc:acf:post_field field="coming_soon"}} is Yes

Hope it helps,
Cheers

Hi Friech,

I originally tried what you suggested, but I didn’t get the modal showing. I have just tried it again and same result.

The field {{dc:acf:post_field field="field_609c18d821111"}} is the same as the coming_soon field. By turning on the “field key” in ACF Screen Options it becomes visible. According to ACF’s documentation the field key is the field’s ID.

In either case, I cannot get the modal to display if the Coming Soon checkbox of ticked.

Also, any idea about the modal not centralising?

Many thanks,
Christopher

Hi Christopher,

Unfortunately, we are not able to find the Coming Soon field in the list of ACF fields, and neither found it in the specified Layout. Please let us know how we can find the field implemented in the Layout and where the Coming Soon field in ACF.

Thanks

Hi Tristup,

In your screenshot, please click on “Products” You will see the Coming Soon ACF field in there. For the location of the Layout, please see the screenshot attached. It can be found at Pro > Layouts > Course Product Layout - Grid

Thanks,
Christopher

Hi Christopher,

It seems that you have added the condition in the wrong way, the comparison variable has to be on the left side and the value with which it needs to be compared has to be on the right side. I went ahead and rectified it and added the condition for checking with the value is not blank, and it worked.

NOTE: Please change the condition if it is not correct.

Thanks

Hi Tristup,

How stupid of me! Thanks for correcting it. Tweaking what you did has solved the problem by changing it to {{dc:acf:post_field field="coming_soon"}} is Yes.

Do you have any ideas about the second half of the original query? The modal’s toggle will not center and remains stuck the the right edge of the featured image. I have tried changing the flex everywhere, but it stays where it is.

Thanks,
Christopher

Hi Christopher,

Really sorry for missing out on that point, it due to the left position is set to the 50% instead of the auto. I went ahead and set it and the problem is resolved.

Course-Product-Layout-Grid-Layouts-Pro (2)

Thanks

Thank you again!
Christopher

Hi Christopher,

Glad to help you.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.