Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Checkout Class Reference

Public Member Functions

 __construct (\Magento\Checkout\Model\Session $session)
 
 cancelCurrentOrder ($comment)
 
 restoreQuote ()
 

Protected Attributes

 $session
 

Detailed Description

Checkout workflow helper

Definition at line 13 of file Checkout.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Checkout\Model\Session  $session)
Parameters
\Magento\Checkout\Model\Session$session

Definition at line 23 of file Checkout.php.

25  {
26  $this->session = $session;
27  }

Member Function Documentation

◆ cancelCurrentOrder()

cancelCurrentOrder (   $comment)

Cancel last placed order with specified comment message

Parameters
string$commentComment appended to order history
Returns
bool True if order cancelled, false otherwise

Definition at line 35 of file Checkout.php.

36  {
37  $order = $this->session->getLastRealOrder();
38  if ($order->getId() && $order->getState() != Order::STATE_CANCELED) {
39  $order->registerCancellation($comment)->save();
40  return true;
41  }
42  return false;
43  }
$order
Definition: order.php:55

◆ restoreQuote()

restoreQuote ( )

Restores quote

Returns
bool

Definition at line 50 of file Checkout.php.

51  {
52  return $this->session->restoreQuote();
53  }

Field Documentation

◆ $session

$session
protected

Definition at line 18 of file Checkout.php.


The documentation for this class was generated from the following file: