Skip to content

Quote Item Prices are NULL in cart related events. #18685

@jakwinkler

Description

@jakwinkler

Preconditions (*)

  1. Magento 2.1.15 EE

Steps to reproduce (*)

  1. Create a module to observer following events:
  • checkout_cart_product_add_after
  • checkout_cart_product_update_after
  1. Try to get values of quote item price in observers:
    /**
     * @param \Magento\Framework\Event\Observer $observer
     */
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        /** @var \Magento\Quote\Model\Quote\Item $item */
        $item = $observer->getEvent()->getData('quote_item');
        $item->load($item->getId());
// part of my debug session
        var_dump(get_class($item));    // wil return correct class
        var_dump($item->getCustomPrice());  // will return NULL
        var_dump($item->getBasePrice());    // will return NULL
        die();
    }

Expected result (*)

  1. Quote Item Prices are loaded from database (they are set in quote_item table)
  2. Be able to control product price on update action

Actual result (*)

  1. Quote Item prices are NULL
  2. Can't control quote item price (setCustomPrice) becasue I don't know previous price (also customized one)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: QuoteEvent: mm18mxFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions