Skip to content

Inconsistent quote item isVirtual value #34089

@MeCapron

Description

@MeCapron

Preconditions (*)

  1. Magento 2.4.2 (but on all versions)

Steps to reproduce (*)

  1. Have a quote of 2 items
  2. Save only ONE specific product
  3. Look at isVirtual value from the 2 products, the saved quote item will have a boolean value, the other one will have a string ('1'/'0') value

Expected result (*)

  1. Quote items should have the same value in all cases

Actual result (*)

  1. Look at isVirtual value from the 2 products, the saved will have a boolean value, the other one will have a string ('1'/'0') value

This inconsistent behavior is done by the beforeSave function of \Magento\Quote\Model\Item line 274

I couldn't find why this line was introduced because it is present since the very first commit (2014). A simple workaround would be to replace

$this->setIsVirtual($this->getProduct()->getIsVirtual()); to $this->setIsVirtual($this->getProduct()->getIsVirtual() ? '1' : '0');

However, this line does not seem to be useful at all.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • 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: FrameworkComponent: Framework/AppIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P4No current plan to fix. Fixing can be deferred as a logical part of more important work.Progress: dev in progressReported on 2.4.2Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions