OrderNoticesTrait

Type
Trait
Namespace
craft\commerce\elements\traits
Implemented by
craft\commerce\elements\Order
Since
3.3

Adds order notice getters and setters.

View source (opens new window)

# Public Methods

Method Description
addNotice() Adds a new notice
addNotices() Adds a list of notices.
clearNotices() Removes notices for all types or a single type.
getFirstNotice() Returns the first error of the specified type or attribute
getNotices() Returns the notices for all types/attributes or a single type/attributes.
hasNotices() Returns a value indicating whether there is any notices.

# addNotice()

Since
3.3

Adds a new notice

View source (opens new window)

Arguments

  • $notice

# addNotices()

Since
3.3

Adds a list of notices.

View source (opens new window)

Arguments

# clearNotices()

Since
3.3

Removes notices for all types or a single type.

View source (opens new window)

Arguments

# getFirstNotice()

Since
3.3

Returns the first error of the specified type or attribute

View source (opens new window)

Arguments

# getNotices()

Since
3.3

Returns the notices for all types/attributes or a single type/attributes.

View source (opens new window)

Arguments

Returns

craft\commerce\models\OrderNotice[] – Notices for all types or the specified type / attribute. Empty array is returned if no notice.

# hasNotices()

Since
3.3

Returns a value indicating whether there is any notices.

View source (opens new window)

Arguments

Returns

boolean (opens new window) – Whether there is any notices.