-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Closed
Copy link
Labels
Component: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Use with concrete module component label E.g. "Component: Api" + "Catalog"Component: CatalogEvent: dmcdindia1Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressProgress: doneReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releaseReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Major restrictions or short-term circumventions are required until a fix is available.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Milestone
Description
I'm trying to programmatically create a product, but upon the first save, the price is not saved, thus returning 'NULL'. On a second save (with the identical object), the price gets saved.
Preconditions
- Magento 2.4-develop
- php v 7.2
Steps to reproduce
/** @var \Magento\Catalog\Model\Product $product */
$product = $this->productFactory->create();
$product->setSku('abc');
$product->setName('Name');
$product->setPrice(9.95);
$product->setAttributeSetId(4);
// Save once, the price does not get saved:
$this->productRepository->save($product);
// Check if the product is saved:
$product = $this->productRepository->get('abc');
$this->assertEquals('abc', $product->getSku()); // passes
$this->assertEquals('Name', $product->getName()); // passes
$this->assertEquals(9.95, $product->getPrice()); // fails (null does not equal 9.95
When I add an extra save()
-instruction it works:
// Save twice, the price gets saved:
$this->productRepository->save($product);
$this->productRepository->save($product);
Expected result
The price should be saved in the first run
Actual result
The price only gets saved the second time the save()
-method is executed
avstudnitz, korostii, j0um and mackieeesamtay, FaridAhamat, korostii, iTymz, elioermini and 1 more
Metadata
Metadata
Assignees
Labels
Component: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Use with concrete module component label E.g. "Component: Api" + "Catalog"Component: CatalogEvent: dmcdindia1Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressProgress: doneReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 releaseReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Major restrictions or short-term circumventions are required until a fix is available.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it