| @@ -94,9 +94,25 @@ | ||
| 94 | 94 | if (!$product || !$product->detail) { |
| 95 | 95 | return __('Product not found', 'fluent-cart'); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | + // On the product page this shortcode is the block theme's | |
| 99 | + // equivalent of what filterSingleProductContent appends for | |
| 100 | + // classic themes, so it answers to the same setting and filter. | |
| 101 | + // Placed anywhere else it is an explicit choice and still renders. | |
| 102 | + if (is_singular(FluentProducts::CPT_NAME)) { | |
| 103 | + $showRelevant = (new StoreSettings())->get('show_relevant_product_in_single_page') == 'yes'; | |
| 104 | + $showRelevant = apply_filters( | |
| 105 | + 'fluent_cart/single_product_page/show_relevant_products', | |
| 106 | + $showRelevant, | |
| 107 | + $productId | |
| 108 | + ); | |
| 98 | 109 | |
| 110 | + if (!$showRelevant) { | |
| 111 | + return ''; | |
| 112 | + } | |
| 113 | + } | |
| 114 | + | |
| 99 | 115 | $products = ShopResource::getSimilarProducts($productId, false); |
| 100 | 116 | if (empty($products)) { |
| 101 | 117 | return ''; |
| 102 | 118 | } |
| @@ -195,9 +211,12 @@ | ||
| 195 | 211 | ]; |
| 196 | 212 | } |
| 197 | 213 | |
| 198 | 214 | $products = $productsQuery->get(); |
| 199 | - (new ShopAppRenderer($products, [ | |
| 215 | + (new ShopAppRenderer([ | |
| 216 | + 'products' => $products, | |
| 217 | + 'total' => $products->total(), | |
| 218 | + ], [ | |
| 200 | 219 | 'default_filters' => $productsQuery->getDefaultFilters(), |
| 201 | 220 | 'custom_filters' => [ |
| 202 | 221 | 'taxonomies' => [ |
| 203 | 222 | $taxFilters |