Home Forums WoodMart support forum Issue with Private Products Not Appearing in AJAX Search or Search Results

Issue with Private Products Not Appearing in AJAX Search or Search Results

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #634673

    Amit
    Participant

    Hello Support Team,

    I am encountering an issue with private products on my website. I added the following code to my functions.php to allow the ‘customer’ role to access private products and product variations:

    /* Enable the ‘customer’ role to read private products and variations */
    function allow_customer_to_read_private_products_and_variations() {
    // Ensure the ‘customer’ role exists
    $role = get_role(‘customer’);
    if ($role) {
    // Add the capabilities to read private products and product variations
    $role->add_cap(‘read_private_products’); // Read private products
    $role->add_cap(‘read_private_product_variations’); // Read private product variations
    }
    }
    add_action(‘init’, ‘allow_customer_to_read_private_products_and_variations’);

    While the customers with the ‘customer’ role can access the private products (as they have the necessary capability), the private products do not show up in the AJAX search or on the search result page.

    Could you please assist in resolving this issue? The expectation is for private products to appear in the AJAX search and search result page for users with the appropriate customer role and capabilities.

    Thank you for your support!

    #634938

    Hello,

    Apologies, but we’re not familiar with how this code is intended to function or how to resolve the issue. Since you’re working with custom code, fixing additional customizations falls outside the scope of our theme support. We hope you understand the limitations of our support.

    Best regards,

    #634970

    Amit
    Participant

    Please guide me on how to enable private products in the search result for customer role.

    • This reply was modified 5 hours, 6 minutes ago by Amit.
    #634971

    Amit
    Participant

    help

Viewing 4 posts - 1 through 4 (of 4 total)