Skip to content

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

Public Methods ​

MethodDescription
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

Arguments ​

  • $notice

addNotices() ​

Since
3.3

Adds a list of notices.

View source

Arguments ​

clearNotices() ​

Since
3.3

Removes notices for all types or a single type.

View source

Arguments ​

  • $type (string, null) – Type name. Use null to remove notices for all types.
  • $attribute

getFirstNotice() ​

Since
3.3

Returns the first error of the specified type or attribute

View source

Arguments ​

getNotices() ​

Since
3.3

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

View source

Arguments ​

  • $type (string, null) – Type name. Use null to retrieve notices for all types.
  • $attribute (string, null) – Attribute name. Use null to retrieve notices for all attributes.

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

Arguments ​

  • $type (string, null) – Type name. Use null to check all types.
  • $attribute (string, null) – Attribute name. Use null to check all attributes.

Returns ​

boolean – Whether there is any notices.