Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

[Product Collection] Add Price Range Filter #11931

Closed
wants to merge 10 commits into from

Commits on Nov 24, 2023

  1. Add Price Range Filter to Product Collection Block

    - Introduced 'priceRange' attribute in the DEFAULT_QUERY and DEFAULT_FILTERS within `constants.ts` to initialize the new price range filter.
    - Added new SCSS rules in `editor.scss` for styling the price range control.
    - Implemented `PriceRangeControl` in `inspector-controls/index.tsx` to enable users to specify a price range for product filtering.
    - Created `PriceTextField.tsx` and `index.tsx` under `inspector-controls/price-range-control`, providing the UI for entering minimum and maximum price values.
    - Extended the `ProductCollectionQuery` and `PriceRange` interfaces in `types.ts` to type-check the new price range functionality.
    - Updated `ProductCollection.php` to handle the price range data when constructing the product query, ensuring products are filtered based on the specified price range.
    imanish003 committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    96bead2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0eb7ef2 View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2023

  1. Enhanced Price Range Control with Currency Symbol and Flexible Width

    - Removed the `max-width` restriction from `.wc-block-product-price-range-control` in `editor.scss`.
    
    - Introduced currency symbol support in `PriceTextField.tsx` by importing `getCurrency` from `@woocommerce/price-format`. The currency symbol is now displayed as a suffix in the price input fields, providing a clearer context for the prices being entered.
    
    - Implemented `step="any"` attribute in `NumberControl` within `PriceTextField.tsx`. This modification allows for more precise price inputs, accommodating prices with decimal values.
    imanish003 committed Nov 28, 2023
    Configuration menu
    Copy the full SHA
    d796e7c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3c9bc75 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4be9688 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7f68a58 View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2023

  1. Configuration menu
    Copy the full SHA
    dd696bf View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2023

  1. Update ProductCollection to handle tax-adjusted price filters

    The changes primarily focus on the following areas:
    1. **Tax Adjustment Incorporation**: The logic now includes an adjustment for tax considerations. This is facilitated by the newly added `should_adjust_price_range_for_taxes()` method, which determines if the price filters need to be adjusted based on the discrepancy between price storage and display methods concerning tax inclusion.
    
    2. **Tax Class Handling**: A new method `adjust_price_range_for_tax_classes()` has been implemented. It adjusts the price range for each tax class, ensuring accurate and relevant calculations. This method is essential for handling various tax scenarios and classes, improving the accuracy of price range filtering.
    
    3. **Price Adjustment Logic**: The `adjust_price_value_for_tax_class()` method has been added for detailed tax adjustments. This method adjusts price values based on tax classes and the tax display settings, using logic akin to `wc_get_price_excluding_tax` and `wc_get_price_including_tax` from WooCommerce core.
    
    4. **Meta Query Construction**: A new method `build_meta_query_for_price_range()` constructs the meta query for filtering products within the specified price range. This method simplifies and consolidates the meta query construction process.
    
    Overall, these changes aim to make the price filtering feature more robust, especially in scenarios involving different tax setups. The update enhances the module's flexibility and accuracy in handling diverse pricing scenarios.
    imanish003 committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    bfb21bc View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2023

  1. Merge branch 'trunk' of https://github.com/woocommerce/woocommerce-bl…

    …ocks into 9360-product-collection-filters-price-range
    imanish003 committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    3d30f34 View commit details
    Browse the repository at this point in the history
  2. Fix build error

    imanish003 committed Dec 8, 2023
    Configuration menu
    Copy the full SHA
    c07536c View commit details
    Browse the repository at this point in the history