Conditional Visibility inside Query Loop with Front End Rendering

Hi, @Louis , I know this issue hasn’t been discussed for a while. But I am experiencing a few issues with Display Conditions using Frontend Rendering on a WC site.

I can confirm this is a problem. In my case it happens when I’m trying to show/hide a product Sale Price when it’s On/Not on Sale. The option simply doesn’t work, either hiding the block completely, or not hiding it at all on all products, with no distinction between On Sale and not on sale products.

Moreover, the “Sale Percentage” option for the Dynamic Value returns nothing.

I though this was an error on my end, or something related to me excluding products in a specific custom Taxonomy Term from the query, or because I’m using a (whitelisted) shortcode for the product title. But after further testing this without these options, the problem persist.

I also have some customizations on my store, where I apply some taxonomy terms automatically (for example, if a product is on Sale, it gets the ‘Sale’ term from a custom taxonomy applied to it automatically). I tried to test the Display Conditions by using the option Post Term === Sale, and the result is that nothing appears on the frontend at all when this option is selected.

image

When looking further I can also see the Visibility Query Parameter for Products in the Query Editor has no effect on the frontend at all. I had to use Stock Status : In Stock.

I’m not sure this is a problem specific to this website or not, as the website is at least 7 years old, and has gone through a lot (despite my best efforts to clean it up).

Here are some of the settings for this query:

  • Template Part: Product Catalog (from the default WooCommerce).
  • Frontend Rendering is on
  • Infinite Load More is on
  • Query is almost identical do the one in this article.

Site Info (from Site Health):

Click to reveal

wp-core

version: 6.4.3
site_language: pt_BR
user_language: en_US
timezone: America/Sao_Paulo
permalink: /%category%/%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: closed
environment_type: development
user_count: 7970
dotorg_communication: true

wp-active-theme

name: Hello PW (cc-hello-pw)
version: 1.0.0
author: Nicholas Zein
parent_theme: Cwicly Theme (cwicly)
theme_features: core-block-patterns, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, widgets-block-editor, block-templates, editor-color-palette, align-wide, experimental-link-color, menus

wp-parent-theme

name: Cwicly Theme (cwicly)
version: 1.0.3
author: Cwicly
author_website: https://cwicly.com

wp-plugins-active (24)

Brazilian Market on WooCommerce: version: 4.0.2, author: Claudio Sanches
Claudio Sanches - Correios for WooCommerce: version: 4.2.5, author: Claudio Sanches
Code Snippets Pro (Premium): version: 3.6.3, author: Code Snippets Pro
Cwicly: version: 1.4.1.1, author: Cwicly
Default Attributes for WooCommerce: version: 1.1.6, author: Condless
EWWW Image Optimizer: version: 7.3.0, author: Exactly WWW
OpenPix for WooCommerce: version: 2.10.8, author: OpenPix
PayPal Brasil para WooCommerce: version: 1.4.9, author: PayPal
Rank Math SEO: version: 1.0.213, author: Rank Math
Rank Math SEO PRO: version: 3.0.56, author: Rank Math
WooCommerce: version: 8.6.1, author: Automattic
WooCommerce Conditional Shipping and Payments: version: 1.15.4, author: WooCommerce
WooCommerce PayPal Payments: version: 2.5.4, author: WooCommerce
Wordfence Security: version: 7.11.3, author: Wordfence

wp-server

server_architecture: Linux 5.15.0-91-generic x86_64
httpd_software: nginx/1.25.3
php_version: 7.4.33 64bit
php_sapi: fpm-fcgi
max_input_variables: 25000
time_limit: 300
memory_limit: 16384M
max_input_time: 300
upload_max_filesize: 2048M
php_post_max_size: 2048M
curl_version: 7.81.0 OpenSSL/3.0.2
suhosin: false
imagick_availability: true
pretty_permalinks: true
current: 2024-02-27T22:50:47+00:00
utc-time: Tuesday, 27-Feb-24 22:50:47 UTC
server-time: 2024-02-27T19:50:45-03:00

wp-database

extension: mysqli
server_version: 10.6.17-MariaDB-1:10.6.17+maria~ubu2204
client_version: mysqlnd 7.4.33
max_allowed_packet: 67108864
max_connections: 4096

wp-constants

WP_MEMORY_LIMIT: 16000M
WP_MAX_MEMORY_LIMIT: 16000M
WP_DEBUG: true
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: development
WP_DEVELOPMENT_MODE: all
DB_CHARSET: utf8mb4
DB_COLLATE: undefined

wp-filesystem

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable

Any suggestions?