Skip to content

Term Count block does not handle correct product category counts with hidden products #72363

@cr0ybot

Description

@cr0ybot

Description

From @Aljullu in #72313 (review):

In addition to that, the Hoodies categories shows different totals (3 vs 4) in the frontend (while both show the correct value, 3, in the editor). That's because I have one Hoodie product which is 'hidden' in the catalog.

Image

Step-by-step reproduction instructions

  1. Install the WooCommerce plugin and enable experimental blocks in the Gutenberg plugin
  2. Add product categories and products and set one of the products to hidden
  3. Add the Product Categories List block (from WooCommerce), the Terms List block (with show term counts), and the Terms Query block (with Term Count blocks) to a page and ensure all are set to the product category taxonomy
  4. Observe that the term counts in the editor are correct for terms with hidden products but not correct on the front end

Screenshots, screen recording, code snippet

In the screenshots below, Product cat 2 includes one hidden product.

Editor:

Image

Front end:

Image

Environment info

  • WordPress 6.8.3
  • Gutenberg plugin 21.8.1

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions