Conflict Between "Products Visibility by User Roles" Plugin and Theme – Product Visibility Rules Not Fully Enforced

An issue has been identified when using the “Products Visibility by User Roles” plugin developed by Addify in combination with the theme. The plugin is designed to restrict product visibility based on user roles, but the visibility rules are not being fully enforced when the theme is active.

Issue Details
Products that should be shown or hidden for specific user roles are still visible, searchable, or incorrectly hidden on:

  • Search Results Pages
  • Single Product Pages

The plugin developer has suggested that the issue may be caused by a conflict with the theme.

Actions Taken

  • The issue was tested using the default Storefront theme, where the plugin functionality works as intended.
  • Upon switching back to the current theme, the issue reappeared.
  • It appears the theme may override or conflict with WooCommerce hook used by the plugin:
    woocommerce_product_is_visible

Support Requested

  • Confirmation is needed on whether the theme modifies or overrides WooCommerce hooks related to product visibility.
  • Guidance on identifying specific files or functions within the theme that could affect product visibility.
  • Recommendations for resolving this conflict while maintaining compatibility with the plugin.
  • If the theme uses an alternate hook for product visibility, clarification on what it is would help relay this information to the plugin developers for further adjustments.

Additional Information

  • WooCommerce Version: 9.5.2
  • Theme Name and Version: X / PRO Theme 6.5.15
  • Plugin: “Products Visibility by User Roles” (Version 1.5.1 by Addify)

Hey @jake_wiredlans,

Would you mind providing the following information in a Secure Note for us to investigate.

  1. Exact page URL where the issue happens
  2. What products are showing or hidden when it shouldn’t
  3. WordPress Login URL
  4. Admin username and password

You can find the Secure Note button at the bottom of your posts.

Please just note that we do not guarantee a fix for third-party plugin conflicts.

Thanks.

Hi @christian

Thank you for your response. Please see our secured note for further checking.

Hey @jake_wiredlans,

  • We don’t hook into woocommerce_product_is_visible
  • cornerstone/includes/integrations/woocommerce.php and framework/legacy/functions/plugins/woocommerce.php houses most of our WooCommerce integration
  • On your single layout, you probably need to use the condition “Product Is Visible” for your custom layout.

Hope that helps.

Hello, Marc.

Would you be able to indentify which function/hook is being used that affects product visibilty? Thanks

Hey @jake_wiredlans,

I cannot find the root cause but you ask the plugin developer to check those files.

Thank you.

Hi @marc_a,

The plugin developers have come back with the below-
——
Kindly ask the theme support team to add this hook to their theme,

as it will solve your issue. This is because the plugin will not work until the hook is triggered.

public function is_visible() {
$visible = $this->is_visible_core();
return apply_filters( ‘woocommerce_product_is_visible’, $visible, $this->get_id() );
}

wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php

Hi @jake_wiredlans,

It is not clear what this code does, how that works, and how the method is called. Still, you can try the given code by adding it to the functions.php of your Child Theme and check if that works for you.
If that does not work, please contact the plugin author on this and get more details. Please remember that we don’t offer any support to the 3rd Party plugin code and related issues.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.