Skip to content

Ignore discarded prices on Variant#default_price#4108

Closed
waiting-for-dev wants to merge 1 commit intosolidusio:masterfrom
nebulab:waiting-for-dev/ignore_discarded_prices_on_default_price
Closed

Ignore discarded prices on Variant#default_price#4108
waiting-for-dev wants to merge 1 commit intosolidusio:masterfrom
nebulab:waiting-for-dev/ignore_discarded_prices_on_default_price

Conversation

@waiting-for-dev
Copy link
Copy Markdown
Contributor

Description

Fixes bug where discarded prices were taken into account in order to
tell the default price for a variant.

The rationale behind the previous behavior was to be able to render a
price when discarded products are included in the backend products
listing page (see 'Show deleted' checkbox near the top-right edge). It
was introduced in commit 87cef09.

However, this logic was incorrect in two ways:

  • It affected non-discarded variants, where we don't want to consider
    discarded prices.
  • Even for discarded variants, it could lead to display the wrong
    information. As all prices get discarded when a variant is discarded,
    there's no guarantee that the one that is rendered was the previously
    considered as the default.

The list of products on the backend will render the price field for
discarded products as blank. In case we want to track default prices, we
should add a flag to uniquely identify them.

Extracted from #3994

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

Fixes bug where discarded prices were taken into account in order to
tell the default price for a variant.

The rationale behind the previous behavior was to be able to render a
price when discarded products are included in the backend products
listing page (see 'Show deleted' checkbox near the top-right edge). It
was introduced in commit 87cef09.

However, this logic was incorrect in two ways:

- It affected non-discarded variants, where we don't want to consider
  discarded prices.
- Even for discarded variants, it could lead to display the wrong
  information. As all prices get discarded when a variant is discarded,
  there's no guarantee that the one that is rendered was the previously
  considered as the default.

The list of products on the backend will render the price field for
discarded products as blank. In case we want to track default prices, we
should add a flag to uniquely identify them.
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/ignore_discarded_prices_on_default_price branch from f5d8f00 to e99acb3 Compare June 21, 2021 04:34
@kennyadsl kennyadsl added Important Change changelog:solidus_core Changes to the solidus_core gem labels Jun 21, 2021
@waiting-for-dev
Copy link
Copy Markdown
Contributor Author

We're closing it as we'll be revisiting this stuff in the context of services objects.

@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/ignore_discarded_prices_on_default_price branch September 4, 2023 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_core Changes to the solidus_core gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants