1

Cart items clear before payment success if the payment is failed then cart products are cleared in API. Actually I need if payment is failed the product no need to remove from carts this case working in web but not in API !!. how can i solve this problem in Magento 2.3

Thanks

1 Answer 1

1

You can reset your cart using the following code.

$quotefactory = $objectManager->get('Magento\Quote\Model\QuoteFactory');
$quote = $quotefactory->create()->load('your_quote_id');
$quote->setIsActive(true);
$quote->save();

NB: I used object manager as a reference. Do not use object manager in your code.

3
  • Thanks @dhanus , let me check Aug 23, 2019 at 5:04
  • Okay, let me know if you have any queries on this.
    – dhanus
    Aug 23, 2019 at 5:05
  • Great!! its working Thank you @dhanus Aug 23, 2019 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.