1. Inicio
  2. Base de Conocimientos
  3. Precios mayoristas de WooCommerce Premium
  4. Visibilidad del producto
  5. ¿Por qué los productos no aparecen en las búsquedas normales cuando Prices Premium está activo?
  1. Inicio
  2. Base de Conocimientos
  3. Problemas de compatibilidad conocidos
  4. ¿Por qué los productos no aparecen en las búsquedas normales cuando Prices Premium está activo?

¿Por qué los productos no aparecen en las búsquedas normales cuando Prices Premium está activo?

WooCommerce Wholesale Prices Premium has a feature to restrict products exclusive to wholesale customers. However, due to technical limitations, the regular search of WordPress doesn’t filter these restrictions on the products.

It can be confusing to guests and other users to see products that are restricted to them that’s why we disable showing products on the regular search to prevent confusion.

If we didn’t do this, then your guest customers might see wholesale restricted products in their regular search results. Though, even if they did click on one of these restricted products, they would just be redirected to the shop as they don’t have the authorization to view the product page.

However, if you don’t mind your wholesale products showing up to non-authorized users in search query results pages you can re-add products to the regular listings using this snippet. Note that visibility is ignored, they’ll just see all products regardless of wholesale visibility.

function include_product_search( $query ) 
{
if ( !is_admin() && $query->is_search() && (!isset($_GET['post_type']) || $_GET['post_type'] != 'product') )
{
$post_types = $query->get('post_type'); $post_types []= 'product'; $query->set( 'post_type', $post_types );
}
}
add_action( 'pre_get_posts', 'include_product_search' 

The preferred solution is instead of using the regular search, we recommend using WooCommerce’s Product Search widget which is compatible with the wholesale role restrictions.

¿Te ha resultado útil este artículo?

Artículos relacionados

¿Necesita soporte?

¿No encuentra la respuesta que busca?
Contactar con soporte
Completa tu Compra