[bug] Doesn’t account for catalog visibility
-
When the plugin outputs the most recently viewed products, the _hidden meta field isn’t accounted for. So products hidden from the catalog are selected. However, as part of the loop hidden products aren’t displayed. So, if your most recently viewed products were hidden it looks like the area is broken. Because have_posts() is true the area displays, but because some of the products may be hidden the products may all be hidden.
This probably affects both shortcodes.
The fix is pretty simple (but must be applied to both front-end/back-end implementations:
$args['meta_query'][] = [ 'key' => '_visibility', 'value' => 'hidden', 'compare' => '!=', ];
Also, the sorting should be updated for WP 4+, as it seems to be inaccurate/deprecated:
'meta_key' => 'recent_view_time', 'meta_type' => 'DATETIME', 'orderby' => 'meta_value', 'order' => 'DESC',
- The topic ‘[bug] Doesn’t account for catalog visibility’ is closed to new replies.