Skip to content

Special Price To Date is wrongly validated on applySpecialPrice  #39169

Open
@tcoluke

Description

@tcoluke

Preconditions and environment

  • Actually reproduced on Magento 2.4.4-p7 but nothing is changed in recent version

Steps to reproduce

Use Rest API to set special price
/rest/default/V1/products/special-price

provide body like

{
  "prices": [
    {
      "price": 5,
      "store_id": 1,
      "sku": "1181",
      "price_from": "2024-08-02 17:00:00",
      "price_to": "2024-09-12 17:00:00",
      "extension_attributes": {}
    }
  ]
}

then check your price on front-end
admin or whatever

your special price will be visible until tomorrow 17

so instead expire at 2024-09-12 17:00:00 it will expire on 2024-09-13 17:00:00

because of validation on Magento\Catalog\Model\Product\Type\Price::calculateSpecialPrice

            if ($this->_localeDate->isScopeDateInInterval($store, $specialPriceFrom, $specialPriceTo)) {
                $finalPrice = min($finalPrice, (float) $specialPrice);
            }

instead of check in range from -> to
it add to end date 1 day

Magento\Framework\Stdlib\DateTime\Timezone::isScopeDateInInterval

maybe it can be used for other validation but for real not for calculateSpecialPrice it should be in range from -> to set by admin

Expected result

Product special price should expire on date set by admin or 3rd party system by REST API

Actual result

End date is missed and expire day after

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Labels

Area: APIsComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: ready for devReported on 2.4.4-p7Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions