Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
CartManagementInterface Interface Reference
Inheritance diagram for CartManagementInterface:
QuoteManagement

Public Member Functions

 createEmptyCart ()
 
 createEmptyCartForCustomer ($customerId)
 
 getCartForCustomer ($customerId)
 
 assignCustomer ($cartId, $customerId, $storeId)
 
 placeOrder ($cartId, PaymentInterface $paymentMethod=null)
 

Data Fields

const METHOD_GUEST = 'guest'
 

Detailed Description

Interface CartManagementInterface @api

Since
100.0.2

Definition at line 15 of file CartManagementInterface.php.

Member Function Documentation

◆ assignCustomer()

assignCustomer (   $cartId,
  $customerId,
  $storeId 
)

Assigns a specified customer to a specified shopping cart.

Parameters
int$cartIdThe cart ID.
int$customerIdThe customer ID.
int$storeId
Returns
boolean

◆ createEmptyCart()

createEmptyCart ( )

Creates an empty cart and quote for a guest.

Returns
int Cart ID.
Exceptions

Implemented in QuoteManagement.

◆ createEmptyCartForCustomer()

createEmptyCartForCustomer (   $customerId)

Creates an empty cart and quote for a specified customer if customer does not have a cart yet.

Parameters
int$customerIdThe customer ID.
Returns
int new cart ID if customer did not have a cart or ID of the existing cart otherwise.
Exceptions

Implemented in QuoteManagement.

◆ getCartForCustomer()

getCartForCustomer (   $customerId)

Returns information for the cart for a specified customer.

Parameters
int$customerIdThe customer ID.
Returns
\Magento\Quote\Api\Data\CartInterface Cart object.
Exceptions

Implemented in QuoteManagement.

◆ placeOrder()

placeOrder (   $cartId,
PaymentInterface  $paymentMethod = null 
)

Places an order for a specified cart.

Parameters
int$cartIdThe cart ID.
PaymentInterface | null$paymentMethod
Exceptions

Implemented in QuoteManagement.

Field Documentation

◆ METHOD_GUEST

const METHOD_GUEST = 'guest'

Checkout types: Checkout as Guest

Definition at line 20 of file CartManagementInterface.php.


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