The order
module
- class magento.models.order.Order(data, client)[source]View on GitHub
Bases:
Model
Wrapper for the
orders
endpoint- DOCUMENTATION: str = 'https://adobe-commerce.redoc.ly/2.3.7-admin/tag/orders'
Link to the Official Magento 2 API documentation for the endpoint wrapped by the Model
- __init__(data, client)[source]View on GitHub
Initialize an Order object using an API response from the
orders
endpoint
- property excluded_keys: List[str]
API response keys that shouldn’t be set as object attributes by
set_attrs()
- Returns
list of API response keys that shouldn’t be set as attributes
- property items: List[OrderItem]
The ordered items, returned as a list of
OrderItem
objectsNote
When a configurable
Product
is ordered, the API returns data for both the configurable and simple productThe
OrderItem
is initialized using the configurable product data, since the simple product data is incompleteThe
product
andproduct_id
will still match the simple product though
If both entries are needed, the unparsed response is in the
data
dict
- property products: List[Product]
The ordered
items
, returned as their correspondingProduct
objects
- get_invoice()[source]View on GitHub
Retrieve the
Invoice
of the Order- Return type
- property ship_to: dict
Condensed version of the
shipping_address
dict
- class magento.models.order.OrderItem(item, client=None, order=None)[source]View on GitHub
Bases:
Model
Wrapper for the
order/items
endpoint- DOCUMENTATION: str = 'https://adobe-commerce.redoc.ly/2.3.7-admin/tag/ordersitems'
Link to the Official Magento 2 API documentation for the endpoint wrapped by the Model
- __init__(item, client=None, order=None)[source]View on GitHub
Initialize an OrderItem using an API response from the
orders/items
endpoint
- property excluded_keys: List[str]
API response keys that shouldn’t be set as object attributes by
set_attrs()
- Returns
list of API response keys that shouldn’t be set as attributes
- property product: Product
The item’s corresponding
Product
Note
If the ordered item:
Is a configurable product - the child simple product is returned
Has custom options - the base product is returned