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

Public Member Functions

 getItemId ()
 
 setItemId ($itemId)
 
 getSku ()
 
 setSku ($sku)
 
 getQty ()
 
 setQty ($qty)
 
 getName ()
 
 setName ($name)
 
 getPrice ()
 
 setPrice ($price)
 
 getProductType ()
 
 setProductType ($productType)
 
 getQuoteId ()
 
 setQuoteId ($quoteId)
 
 getProductOption ()
 
 setProductOption (\Magento\Quote\Api\Data\ProductOptionInterface $productOption)
 
 getExtensionAttributes ()
 
 setExtensionAttributes (\Magento\Quote\Api\Data\CartItemExtensionInterface $extensionAttributes)
 

Data Fields

const KEY_ITEM_ID = 'item_id'
 
const KEY_SKU = 'sku'
 
const KEY_QTY = 'qty'
 
const KEY_NAME = 'name'
 
const KEY_PRICE = 'price'
 
const KEY_PRODUCT_TYPE = 'product_type'
 
const KEY_QUOTE_ID = 'quote_id'
 
const KEY_PRODUCT_OPTION = 'product_option'
 
- Data Fields inherited from ExtensibleDataInterface
const EXTENSION_ATTRIBUTES_KEY = 'extension_attributes'
 

Detailed Description

Interface CartItemInterface @api

Since
100.0.2

Definition at line 13 of file CartItemInterface.php.

Member Function Documentation

◆ getExtensionAttributes()

getExtensionAttributes ( )

Retrieve existing extension attributes object or create a new one.

Returns
\Magento\Quote\Api\Data\CartItemExtensionInterface|null

Implemented in Item.

◆ getItemId()

getItemId ( )

#- Returns the item ID.

Returns
int|null Item ID. Otherwise, null.

Implemented in Item.

◆ getName()

getName ( )

Returns the product name.

Returns
string|null Product name. Otherwise, null.

Implemented in Item.

◆ getPrice()

getPrice ( )

Returns the product price.

Returns
float|null Product price. Otherwise, null.

Implemented in Item.

◆ getProductOption()

getProductOption ( )

Returns product option

Returns
\Magento\Quote\Api\Data\ProductOptionInterface|null

Implemented in Item.

◆ getProductType()

getProductType ( )

Returns the product type.

Returns
string|null Product type. Otherwise, null.

Implemented in Item.

◆ getQty()

getQty ( )

Returns the product quantity.

Returns
float Product quantity.

Implemented in Item.

◆ getQuoteId()

getQuoteId ( )

Returns Quote id.

Returns
string

Implemented in Item.

◆ getSku()

getSku ( )

Returns the product SKU.

Returns
string|null Product SKU. Otherwise, null.

Implemented in Item.

◆ setExtensionAttributes()

setExtensionAttributes ( \Magento\Quote\Api\Data\CartItemExtensionInterface  $extensionAttributes)

Set an extension attributes object.

Parameters
\Magento\Quote\Api\Data\CartItemExtensionInterface$extensionAttributes
Returns
$this

◆ setItemId()

setItemId (   $itemId)

Sets the item ID.

Parameters
int$itemId
Returns
$this

Implemented in Item.

◆ setName()

setName (   $name)

Sets the product name.

Parameters
string$name
Returns
$this

Implemented in Item.

◆ setPrice()

setPrice (   $price)

Sets the product price.

Parameters
float$price
Returns
$this

Implemented in Item.

◆ setProductOption()

setProductOption ( \Magento\Quote\Api\Data\ProductOptionInterface  $productOption)

Sets product option

Parameters
\Magento\Quote\Api\Data\ProductOptionInterface$productOption
Returns
$this

◆ setProductType()

setProductType (   $productType)

Sets the product type.

Parameters
string$productType
Returns
$this

Implemented in Item.

◆ setQty()

setQty (   $qty)

Sets the product quantity.

Parameters
float$qty
Returns
$this

Implemented in Item.

◆ setQuoteId()

setQuoteId (   $quoteId)

Sets Quote id.

Parameters
string$quoteId
Returns
$this

Implemented in Item.

◆ setSku()

setSku (   $sku)

Sets the product SKU.

Parameters
string$sku
Returns
$this

Implemented in Item.

Field Documentation

◆ KEY_ITEM_ID

const KEY_ITEM_ID = 'item_id'

#+ Constants defined for keys of array, makes typos less likely

Definition at line 18 of file CartItemInterface.php.

◆ KEY_NAME

const KEY_NAME = 'name'

Definition at line 24 of file CartItemInterface.php.

◆ KEY_PRICE

const KEY_PRICE = 'price'

Definition at line 26 of file CartItemInterface.php.

◆ KEY_PRODUCT_OPTION

const KEY_PRODUCT_OPTION = 'product_option'

Definition at line 32 of file CartItemInterface.php.

◆ KEY_PRODUCT_TYPE

const KEY_PRODUCT_TYPE = 'product_type'

Definition at line 28 of file CartItemInterface.php.

◆ KEY_QTY

const KEY_QTY = 'qty'

Definition at line 22 of file CartItemInterface.php.

◆ KEY_QUOTE_ID

const KEY_QUOTE_ID = 'quote_id'

Definition at line 30 of file CartItemInterface.php.

◆ KEY_SKU

const KEY_SKU = 'sku'

Definition at line 20 of file CartItemInterface.php.


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