Skip Navigation

[Resolved] WooCommerce Views conditional output not working

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to use the woocommerce views shortcodes in our views conditional shortcode.

Solution:

To get this to work all that is needed is to add it to our views Third-party shortcode arguments. This option can be found in Toolset -> Settings -> Frontend.

From here you can add the shortcode name "wpv-woo-productcategory-images" This should resolve your issue of the shortcode not working in the conditionals.

This support ticket is created 5 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 8 replies, has 2 voices.

Last updated by thomasS-11 5 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#1193799

Hi.

I want to display something, if [wpv-woo-productcategory-images] is empty.
[wpv-woo-productcategory-images] doesn't exist in conditional output selector.

So i tried to manually insert the field in the condition like below, but it is not working either.

        [wpv-conditional if="( '[wpv-woo-productcategory-images]' eq '' )"]
        <img src="<em><u>hidden link</u></em>">
        [/wpv-conditional]
#1193880

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Thomas,

Thank you for contacting our support forum.

Could you add the debug='true' attribute to your shortcode and let me know what the output on the frontend is.

Thanks,
Shane

#1194202
        <!-- Added the debug attribut to the conditional operator -->
        [wpv-conditional if="( '[wpv-woo-productcategory-images]' eq '' )" debug='true']
        <img src="<em><u>hidden link</u></em>">
        [/wpv-conditional]
        
        <!-- To simply test the debug attribute.. -->
        [wpv-woo-productcategory-images debug='true']

Nothing happens.

#1194447

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Thomas,

The debug information is printed on the frontend.

SO you will need to check the frontend where this conditional is being loaded to get information on this.

Thanks,
Shane

#1195989

I did check the frontend. No debug info available.

#1196145

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Thomas,

Thank you for the information.

Would it be possible for you to provide me with access to the site as well as a link to the page.

It is quite strange that the debug information is not showing because this would clue me to the reason for the conditional not working.

The private fields have been enabled for your next response.

Thanks,
Shane

#1197174

I don't need to verify if the field is empty anymore, because i agreed with the client that they must fill out the field, because i couldn't get it to work and it took too much time.

I suggest you make a WP installation with WooCommerce, Views and WooCommerce Views, and try to verify it. You cannot verify if the [wpv-woo-productcategory-images] field is empty or not empty. "eq" or "ne" both returns nothing.

#1197299

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Thomas,

You are absolutely correct.

Given that the shortcode is generated by woocommerce views it is an expected outcome. It is because the [wpv-woo-productcategory-images] shortcode isn't a part of the views core plugin.

To get this to work all that is needed is to add it to our views Third-party shortcode arguments. This option can be found in Toolset -> Settings -> Frontend.

From here you can add the shortcode name "wpv-woo-productcategory-images" This should resolve your issue of the shortcode not working in the conditionals.

Thanks,
Shane

#1199343

Thank you Shane. I'm kind of surprised that since it is a WooCommerce Views shotcode, that it didn't work with Views.
Didn't think about adding it from the settings page.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.