term_exists not finding restricted categories

We are running an automated import to add/update products on our site regularly.
When the product is in a restricted category, our code to check if the category already exists is returning false:

$subcat = term_exists( $level2,'product_cat', $catid);

Please advise ASAP

2 Responses to term_exists not finding restricted categories

  1. George September 5, 2023 at 10:50 am #

    Hi Gitty,

    Thanks for sharing your code with us, I’ve made some tests using it and have recorded my results. Please make sure to check your email for my reply and the test results I got.

    I think it would be better if you run a debug on your code, the issue apparently resides elsewhere. If further assistance is needed, you are more than welcome to follow-up here.

    Kind regards,
    George

  2. George September 1, 2023 at 6:32 pm #

    Hi Gitty,

    Many thanks for using our plugin on your site, we appreciate it!

    I think it would be better if you could share some more context of the code you’re running.
    The function alone, term_exists(), is not affected by the restrictions applied by Groups or Groups Restrict Categories. If your implementation is private, then you are more than welcome to share it via a private repository( ie via Bitbucket), or directly by email, using my personal address, george at itthinx dot com.
    We are willing to review your code and if needed, obviously we will take your use case into account and update Groups accordingly.

    Kind regards,
    George

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