There is a PHP syntax error in the FluentCart plugin that causes error messages and file paths to be displayed on product cards in archive/shop pages.
File: app/Services/Renderer/ProductCardRender.php
Line: 45
<div data-fluent-cart-shop-app-single-product data-fc-product-card=""
class="fc-single-product-card" <?php echo esc_attr($cursor); ?>
style="width: <?php echo esc_attr($this->config['card_width'] . 'px' ?? ''); ?>;">The null coalescing operator (??) is placed after the string concatenation, which means:
- It concatenates
$this->config['card_width'] . 'px'first - Then checks if the result is null (which a string never is)
- When
$this->config['card_width']doesn't exist, PHP throws a warning that gets output to the page
This results in error messages being displayed on product cards:
/Users/.../wp-content/plugins/fluent-cart/app/Services/Renderer/ProductCardRender.php on line 45
px;">
<div data-fluent-cart-shop-app-single-product data-fc-product-card=""
class="fc-single-product-card" <?php echo esc_attr($cursor); ?>
style="width: <?php echo esc_attr(isset($this->config['card_width']) ? $this->config['card_width'] . 'px' : ''); ?>;">- First checks if
$this->config['card_width']exists usingisset() - Only concatenates with
'px'if the value exists - Returns empty string if it doesn't exist
- No PHP warnings or errors are generated
- Install FluentCart plugin
- Create products with categories
- Visit any product category archive page
- View the product cards - you'll see error messages displayed
- FluentCart Version: 1.2.2 (and likely other versions)
- PHP Version: 8.x (where display_errors might be on)
- WordPress Version: 6.8.3
- Severity: Medium/High
- Error messages with file paths are visible to end users
- Affects all product archive, category, and brand pages
- Makes the site look unprofessional
- Could expose server file structure information
Update line 45 in app/Services/Renderer/ProductCardRender.php with the corrected code above.
This is a common PHP mistake where the null coalescing operator is placed incorrectly. The operator should check if the array key exists before concatenation, not after.
Reported by: BuddyX Theme Development Team Date: 2025-01-17 Plugin: FluentCart Version: 1.2.2