Okay
  Public Ticket #4533576
​Product visibility
Open

Comments

  •  1
    Aptum started the conversation

    Product visibility does not seem to work based on the B2B king category visibility settings.

    B2B King is in some cases returning yes/no strings in the woocommerce_product_is_visible filter. Shouldn't this be a boolean? Does 'no' mean the product should be hidden? The correct visibility does not seem to be set on the product objects.

  •   WebWizards replied privately
  •  1
    Aptum replied

    No longer see "no" returned as visibility.

    Found another strange case where a product was in category a and b. Category a is the parent of b. Category b is not visible to anyone. The expected outcome was that the product would get visibility from b and be hidden, but the result is it got it from a and was set to visible to everyone.

    is_visible is still true, even on products that is considered hidden by b2b king. Is that expected behaviour? Is there another helper function that can check if the product is considered hidden by the b2bking visibility settings?


  •  2,636
    WebWizards replied

    Thanks for the update,

    That situation is a bit tricky and can depend on the rest of your visibility settings as well. Generally, we recommend trying to avoid situations where visibility is category-based but the categories themselves have different visibility settings, as this can lead to unpredictable results.

    Something you can try is adding this code snippet:

    add_filter('b2bking_category_visibility_direct_categories_only','__return_true');

    This filter should help ensure that the direct parent category is the one used for determining visibility.

     

    That said, the final effects may depend on the rest of your visibility settings.

    Kind regards,
    Stefan