PhoenixKit.Modules.Shop.Import.Filter (phoenix_kit v1.7.62)

Copy Markdown View Source

Filter products for import based on configurable rules.

Supports both legacy hardcoded keywords (for backward compatibility) and configurable ImportConfig-based filtering.

Configuration-based filtering

config = Shop.get_default_import_config()
Filter.should_include?(rows, config)
Filter.categorize(title, config)

Legacy filtering (backward compatible)

Filter.should_include?(rows)  # Uses hardcoded defaults
Filter.categorize(title)      # Uses hardcoded defaults

Summary

Functions

Categorize product based on title keywords.

Check if product should be included in import.

Functions

categorize(title, config \\ nil)

Categorize product based on title keywords.

With config

Filter.categorize(title, config)

Uses category_rules from config. Returns default_category_slug if no match.

Without config (legacy)

Filter.categorize(title)

Uses hardcoded category rules. Returns "other-3d" if no match.

should_include?(rows, config \\ nil)

Check if product should be included in import.

With config

Filter.should_include?(rows, config)

Returns true if:

  • Config has skip_filter: true, OR
  • Title matches at least one include keyword AND
  • Title does NOT match any exclude keyword/phrase

Without config (legacy)

Filter.should_include?(rows)

Uses hardcoded default keywords for backward compatibility.