Skip to content

Conversation

malinajirka
Copy link
Contributor

#WOOMOB-1443

Description

This PR filters out unsupported products and variations in the Local Catalog. Variations were filtered out even before, but they are filtered out on the database layer now.

Testing information

  1. Verify downloadable products are not visible in the POS
  2. Verify downloadable variation isn't visible in the POS
  3. Verify product with non-published status isn't visible in the POS

The tests that have been performed

The above

Images/gif

N/A

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@malinajirka malinajirka added this to the 23.5 milestone Oct 16, 2025
@malinajirka malinajirka requested a review from Copilot October 16, 2025 09:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR moves product and variation filtering from the application layer to the database layer, ensuring only supported items (published, non-downloadable, simple/variable products) are retrieved from the Local Catalog. This change improves performance by reducing in-memory filtering and ensures consistency across the POS feature.

  • Filtering moved from application layer to database queries for products and variations
  • Added SQL conditions to filter out unpublished, downloadable, and unsupported product types
  • Removed redundant applyFilter() function since filtering now happens at database level

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
WooPosProductsDao.kt Added SQL filters for status, product type, and downloadable flag to product query
WooPosVariationsDao.kt Added SQL filters for status and downloadable flag to variation query
WooPosVariationsInDbDataSource.kt Removed application-layer filtering function now handled by database
WooPosProductsTypesFilterConfig.kt Added clarifying comment about Local Catalog filtering location

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 16, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commitee00183
Direct Downloadwoocommerce-wear-prototype-build-pr14767-ee00183.apk

@malinajirka malinajirka requested a review from kidinov October 16, 2025 09:40
@malinajirka malinajirka marked this pull request as ready for review October 16, 2025 09:40
@wpmobilebot
Copy link
Collaborator

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commitee00183
Direct Downloadwoocommerce-prototype-build-pr14767-ee00183.apk

@malinajirka malinajirka modified the milestones: 23.5, 23.6 Oct 16, 2025
@kidinov kidinov self-assigned this Oct 16, 2025
Copy link
Contributor

@kidinov kidinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

import org.wordpress.android.fluxc.store.WCProductStore.ProductFilterOption
import javax.inject.Inject

// Note: For the Local Catalog feature, the filtering is done locally in WooPosProductsDao.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing the comment, I assume you considered reusing this for the filteriting to have a single source of truth for the whole POS; therefore, just curious why you didn't go with that approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I couldn't figure out a way on how to re-use it.

  1. We likely want to filter on the DB layer for performance/memory reasons.
  2. This config lives in a different module than the DB -> we can't create a circular dependency.
  3. Room queries can reference only constants.
    Wdyt? Can you think of a way on how to re-use it?

@malinajirka malinajirka merged commit 6da2cb0 into trunk Oct 17, 2025
18 of 19 checks passed
@malinajirka malinajirka deleted the issue/woomob-1443-woo-poslocal-catalog-check-only-supported-products-are-v2 branch October 17, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants