Some of our WooCommerce Products are being hidden to guest users

Posted in

From the conversation started here


Hi Kento,

Still trying to track down this bug. Even with the filter commented out we’re still seeing issues with products being hidden from search/category pages.

Here are the steps I’ve taken:

1. Go to /lib/extra/class-groups-extra.php, add a comment to line 35 to disable the visiblity filter.
2. Go to the product settings and verify that no restrictions are set on the product (bear in mind, these are products that never had a restriction on them in the first place).
3. Clear WP Engine Cache, Clear Sucuri Firewall cache.
4. Log out of the WP Admin backend
5. Go to category page, or search for one of the affected SKUs
6. WooCommerce returns “No results found”, or doesn’t display the product on the category page.
7. Disable the Groups plugin entirely
8. Attempt step 5 again, this time it returns the expected results.

This is beyond frustrating at this point, we’re getting numerous complaints and losing sales due to customers not being able to find products on our website. We unfortunately cannot just quit using your plugin, as we do have Pages and other items that do have content restriction settings, but I really need you guys to give us some support here.

This isn’t a caching issue. These products have not and will not ever have any kind of Groups visibility restriction on them. So I’m not sure why cache is being blamed, as these pages wouldn’t have any cached versions of them where the content was hidden. Users logged in as admins can see the products, while guest users cannot, even though there is no setting that should be causing that.

Here is screenshots of the settings of the product, as well as the post meta values for anything I think could be related to your plugin.

https://imgur.com/a/W0J3FGO

Is there some kind of field in the database that could be causing this?

We have a sandbox environment that I will gladly give you access to, which you can use to recreate the issue and fix it.

11 Responses to Some of our WooCommerce Products are being hidden to guest users

  1. George January 24, 2023 at 1:45 pm #

    That’s indeed a great find you have there!

    Also, please try to search through your code, preferably any custom code that might be adding or interfering with this meta data. That’s because this won’t happen when using the plugin’s option to define a Groups access restriction.
    When you add a restriction a meta key is added for that post and when you remove that restriction, the meta key is completely removed.

    Kind regards,
    George

  2. George January 23, 2023 at 12:36 pm #

    Hi there,

    It is obvious that the testing results are not consistent because the archive contents were visible during my tests regardless of the user session, authenticated user or visitor.

    I would like you to try one last thing and then it’s better to proceed with a full debugging on your site.
    Since the issue you have is product specific then there is something special with these products that is not obvious.
    In this new category you’ve created, add another product only this time create a new product without cloning an existing one and file under this category, empty-when-not-logged-in.

    What happens with this new product? Is it still not accessible for non-authenticated users?

    Regarding search it is normal to not get results for a product that is not rendered in the shop archives which in turn relates to the previous issue.

    Please proceed with the aforementioned step and let me know what results you get so that we can proceed with a full site debugging.

    Kind regards,
    George

    • handiquilter January 23, 2023 at 8:10 pm #

      Hmmm. Okay, now we’re on to something.

      The newly created product that was not cloned is showing, regardless of logged in as an admin or just a visitor.

      So I guess the question is, what is the issue with the existing products that would cause this?

      I’ve previously tried looking at the meta values to see if anything stood out but I couldn’t pin point what the issue would be.

    • handiquilter January 23, 2023 at 9:43 pm #

      Starting to find it I believe…

      https://imgur.com/a/maL0IDb

      The problem products seem to have a ‘groups-read’ key with an empty value.

      When I first found it, my assumption was that having no number listed meant that it was accessible to all, but it seems that may not be the case?

      I deleted the empty value for one of the test cases, and sure enough that product is now showing while logged out where it wasn’t before.

  3. George January 16, 2023 at 12:40 pm #

    Hi again,

    Thanks for keeping the access active for our tests.

    As it seems when I deactivate all plugins but Groups, WooCommerce, Advanced Custom Fields PRO, Advanced Custom Fields: Theme Code Pro, all products appear again in their respective archives, either their categories or tags.
    The issue you described most probably relates to a conflict with another plugin being used, or simply there might not even be enough resources to handle an installation of more than 70 plugins activated at the same time.

    Furthermore, the search functionality appearing in the archives doesn’t work regardless of whether Groups is activated or not. Still though this can relate to the fact that almost everything is deactivated at the moment.

    I would recommend you to have a look at the staging site again, now that almost everything is off, and let me know if further assistance is needed.

    Kind regards,
    George

    • handiquilter January 23, 2023 at 6:18 am #

      Hi,

      This issue is still happening, even with all the plugins disabled.

      Take for example a search for ‘QF00037’ which is the SKU for the HQ Super Quilt Clamp (Small) product.

      When not logged in, no search results are found for the term. (Screenshot 1)
      When logged in as an admin, WooCommerce directs straight to the product page. (Screenshot 2)
      Settings on the product show the read access is set to anyone, not limited to any groups (Screenshot 3)

      https://imgur.com/a/jg58SyK

    • handiquilter January 23, 2023 at 6:31 am #

      Just to make things clearer, I took 5 of the products that are experiencing this issue.

      I placed them all in a “Empty When Not Logged In” category.

      https://hqdevcan.wpengine.com/product-category/empty-when-not-logged-in/

      All 5 of these products are set to let ‘Anyone’ access them.

      Screenshot 1 – Showing all 5 products in the category
      Screenshot 2 – Shows all 5 products visible when logged in as an admin user
      Screenshot 3- Shows 0 of 5 products when not logged in

      https://imgur.com/a/vKZ55hB

      Now keep in mind, all products show up again as soon as I disable the Groups plugin. If Groups is turned off, suddenly all the products are visible again, its only broken when we have that turned on.

      Here are the steps you can follow to recreate the issue.

      1. Log in as admin
      2. Confirm Groups plugin is enabled
      3. Go to https://hqdevcan.wpengine.com/product-category/empty-when-not-logged-in/
      4. Confirm all 5 products are visible as expected.
      5. Log out of the website
      6. Go back to https://hqdevcan.wpengine.com/product-category/empty-when-not-logged-in/
      7. Confirm 0 products are now visible
      8. Log back in as admin
      9. Turn off Groups plugin.
      10. Log out of the website again.
      11. Go back to https://hqdevcan.wpengine.com/product-category/empty-when-not-logged-in/
      12. Confirm all 5 products are visible.

      We have almost every plugin turned off at this point. The server resources have never been an issue, and I don’t have any reason to believe that is the case, especially when the issue is resolved solely by enabling or disabling the Groups plugin.

    • handiquilter January 23, 2023 at 4:43 pm #

      Sorry, one last reply as I’m continuing to test things to try and remove any other sort of factors.

      Other things I tried —
      Renaming woocommerce template folder from the theme to a different name so it was only using WooCommerce default theme files, no change, issue still present.

      Changed active theme to WordPress’s TwentyTwenty theme, issue is still present.
      When TwentyTwenty is active it does show that 5 products are in the category, but they are still not displayed until Groups plugin is disabled.

      https://imgur.com/ixmicJi

  4. George January 13, 2023 at 10:00 pm #

    Hi,

    Thanks for providing access to your staging site and many thanks for your cooperation.

    We are already checking your setup and running various tests with your components.
    Please make sure to keep the staging running and our access active until we finish our review.
    We will report back as soon as we have an update on this matter.

    Kind regards,
    George

  5. handiquilter January 13, 2023 at 5:21 pm #

    Hi, thanks I have set up a user for you on the staging site here: https://hqdevcan.wpengine.com/

    It has an initial username/password you must enter before you can even access the site.

    User: xxxx
    Password: xxxxx

    Once that is entered you should have access to the site.

    I have updated the wp-config.php file with the changes you requested.

    An admin user has been created with the email you provided, username is xxxxxxxx.

    You’re okay to turn off plugins as needed, though Advanced Custom Fields is used for quite a lot of functionality, so turning that off may cause lots of errors.

    These are all of the example products that exhibiting the behavior:
    QF12408 Gallery Hand Wheel Kit
    https://hqdevcan.wpengine.com/product/gallery-frame-hand-wheel-kit/

    QF00041 Large Super Quilt Clamps
    https://hqdevcan.wpengine.com/product/gallery-quilt-clamps/

    QF00037 Small Super Clamps
    https://hqdevcan.wpengine.com/product/super-quilt-clamp/

    HG00448 18” Ruler Base
    https://hqdevcan.wpengine.com/product/18-inch-easy-fit-ruler-base/

    HG00449 16” Ruler Base
    https://hqdevcan.wpengine.com/product/16-inch-easy-fit-ruler-base/

    Pretty much, go to:
    https://hqdevcan.wpengine.com/shop/ and try searching for any of the SKUs above (example: QF12408), while logged out.

    * [Edit:removed sensitive data]

  6. Kento January 13, 2023 at 3:27 pm #

    Hi!

    We’ve moved this to a topic to focus on it here. Can you please provide temporary admin access for support at itthinx dot com to the staging/sandbox site you mentioned and make sure to enable debugging for the site – add this to your wp-config.php:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );

    … and comment out the line that says define( 'WP_DEBUG', false );.

    IMPORTANT: Replace the copy of Groups you have on the site with a clean copy that has no modifications. You can simply remove and re-install Groups for that purpose.

    After you’ve done that, please try to access the product that should be visible but isn’t.

    Then proceed to add this to your wp-config.php:

    define( 'WPE_GOVERNOR', false );

    Repeat the test and see if it still presents the issue.

    Once we have access, please confirm that we can deactivate, remove or activate any plugins on the staging site, as we’ll need to do that for tests.

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share