Description
For products with multiple prices (e.g. a product which has monthly and annual subscription prices), I would expect to be able to sort the product's prices by some known Price key, eg unit_price, and define the sort order. The prices are currently ordered by ID, as defined in elements/Product.php:
|
private function createPriceQuery(): PriceQuery |
|
{ |
|
return Price::find() |
|
->owner($this) |
|
->orderBy(['id' => SORT_ASC]); |
|
} |
In the same way that Product::getPrices() can be passed criteria (per issue #97, resolved by PR #98), it would be very nice to be able to pass a sort order override.
Steps to reproduce
- Set up a Product in Stripe
- Add multiple prices to that Product
- Retrieve the prices for the product using
product.prices or product.getPrices()
- Observe that the order is fixed by ID
Additional info
- Craft version: 5.10
- PHP version: 8.4
- Stripe plugin: 1.7.2
Description
For products with multiple prices (e.g. a product which has monthly and annual subscription prices), I would expect to be able to sort the product's prices by some known
Pricekey, egunit_price, and define the sort order. The prices are currently ordered byID, as defined in elements/Product.php:stripe/src/elements/Product.php
Lines 734 to 739 in a934abd
In the same way that
Product::getPrices()can be passed criteria (per issue #97, resolved by PR #98), it would be very nice to be able to pass a sort order override.Steps to reproduce
product.pricesorproduct.getPrices()Additional info