Order
+ Inheritance diagram for Order:

Description

An order.

Orders cannot be placed through the REST API.

Shopify allows order creation on the condition that it's for archival purposes, like if you're migrating from somewhere. Only finalized orders can be created, whether that finalization happened through fulfillment or cancellation.

Open orders cannot be created through the API. Consider using a DraftOrder instead.

Orders are mostly immutable except for a few things, which are documented here.

  • billing_address
  • buyer_accepts_marketing
  • email
  • metafields
  • note
  • note_attributes
  • phone
  • shipping_address
  • tags
See also
https://shopify.dev/docs/admin-api/rest/reference/orders/order

Public Properties

const DIR = 'orders'
 
const FULFILLMENT_COMPLETE = 'fulfilled'
 
const FULFILLMENT_NONE = null
 
const FULFILLMENT_PARTIAL = 'partial'
 
const FULFILLMENT_RESTOCKED = 'restocked'
 
const INVENTORY_BYPASS = 'bypass'
 
const INVENTORY_DECREMENT_IGNORE = 'decrement_ignoring_policy'
 
const INVENTORY_DECREMENT_OBEY = 'decrement_obeying_policy'
 
const MAP
 
const PAYMENT_AUTHORIZED = 'authorized'
 
const PAYMENT_COMPLETE = 'paid'
 
const PAYMENT_PARTIAL = 'partially_paid'
 
const PAYMENT_PARTIAL_REFUND = 'partially_refunded'
 
const PAYMENT_PENDING = 'pending'
 
const PAYMENT_REFUNDED = 'refunded'
 
const PAYMENT_VOIDED = 'voided'
 
const SEARCH_FULFILLMENT_ANY = 'any'
 
const SEARCH_FULFILLMENT_PARTIAL = 'partial'
 
const SEARCH_FULFILLMENT_SHIPPED = 'shipped'
 
const SEARCH_FULFILLMENT_UNSHIPPED = 'unshipped'
 
const SEARCH_PAYMENT_ANY = 'any'
 
const SEARCH_PAYMENT_AUTHORIZED = 'authorized'
 
const SEARCH_PAYMENT_COMPLETE = 'paid'
 
const SEARCH_PAYMENT_INCOMPLETE = 'unpaid'
 
const SEARCH_PAYMENT_PARTIAL = 'partially_paid'
 
const SEARCH_PAYMENT_PARTIAL_REFUND = 'partially_refunded'
 
const SEARCH_PAYMENT_PENDING = 'pending'
 
const SEARCH_PAYMENT_REFUNDED = 'refunded'
 
const SEARCH_PAYMENT_VOIDED = 'voided'
 
const SEARCH_STATUS_ANY = 'any'
 
const SEARCH_STATUS_CANCELLED = 'cancelled'
 
const SEARCH_STATUS_CLOSED = 'closed'
 
const SEARCH_STATUS_OPEN = 'open'
 
const TYPE = 'order'
 
- Public Properties inherited from AbstractOrder
const MAP
 
- Public Properties inherited from AbstractEntity
const DIR = ''
 All subclasses must redeclare this to match their REST directory (without container). More...
 
const TYPE = ''
 All subclasses must redeclare this to match their types. More...
 
- Public Properties inherited from Data
const MAP = []
 
const PATCH = []
 

Public Methods

$this cancel ()
 Cancels the order. More...
 
$this close ()
 Closes the order. More...
 
magic string getAppId ()
 
magic string getBrowserIp ()
 
magic bool getBuyerAcceptsMarketing ()
 
magic string getCancelledAt ()
 
magic string getCancelReason ()
 
magic string getCartToken ()
 
magic string getClientDetails ()
 
magic string getClosedAt ()
 
magic string getCurrentTotalDutiesSet ()
 
magic string getCustomerLocale ()
 
magic AppliedDiscount[] getDiscountApplications ()
 
magic Discount[] getDiscountCodes ()
 
magic string getFinancialStatus ()
 
magic Fulfillment[] getFulfillments ()
 
magic string getFulfillmentStatus ()
 
magic string getLandingSite ()
 
magic string getLocationId ()
 
magic string getNumber ()
 
magic string getOrderNumber ()
 
magic string getOrderStatusUrl ()
 
magic string getOriginalTotalDutiesSet ()
 
magic string[] getPaymentGatewayNames ()
 
magic string getPhone ()
 
magic string getPresentmentCurrency ()
 
magic string getProcessedAt ()
 
magic string getProcessingMethod ()
 
magic string getReferringSite ()
 
magic Refund[] getRefunds ()
 
magic Shipping[] getShippingLines ()
 
magic string getSourceName ()
 
magic string getSubtotalPriceSet ()
 
magic string getTaxesIncluded ()
 
magic string getToken ()
 
magic string getTotalDiscounts ()
 
magic string getTotalDiscountsSet ()
 
magic number getTotalLineItemsPrice ()
 
magic string getTotalLineItemsPriceSet ()
 
magic string getTotalPriceSet ()
 
magic string getTotalTaxSet ()
 
magic string getTotalTipReceived ()
 
magic string getTotalWeight ()
 
magic string getUserId ()
 staff account id More...
 
magic bool hasDiscountApplications ()
 
magic bool hasDiscountCodes ()
 
magic bool hasFulfillments ()
 
magic bool hasNoteAttributes ()
 
magic bool hasPaymentGatewayNames ()
 
magic bool hasRefunds ()
 
magic bool hasShippingLines ()
 
magic bool hasTaxLines ()
 
magic bool isTest ()
 
Discount newDiscount ()
 
Fulfillment newFulfillment ()
 
Refund newRefund ()
 
Shipping newShipping ()
 
$this reopen ()
 Reopens a closed order. More...
 
magic $this setBuyerAcceptsMarketing (bool $marketing)
 
magic $this setCancelReason (string $reason)
 
magic $this setDiscountCodes (Discount[] $codes)
 
magic $this setFinancialStatus (string $status)
 
magic $this setFulfillments (string[] $fulfillments)
 
magic $this setFulfillmentStatus (string $status)
 
magic $this setInventoryBehavior (string $behavior)
 
magic $this setLocationId (string $id)
 
magic $this setPhone (string $phone)
 
magic $this setPresentmentCurrency (string $currency)
 
magic $this setProcessedAt (string $iso8601)
 
magic $this setReferringSite (string $site)
 
magic $this setSendFulfillmentReceipt (bool $receipt)
 
magic $this setSendReceipt (bool $receipt)
 
magic $this setShippingLines (Shipping[] $lines)
 
magic $this setSourceName (string $name)
 
magic $this setSubtotalPriceSet (string $set)
 
magic $this setTaxLines (Tax[] $taxes)
 
magic $this setTest (bool $test)
 
magic $this setTotalDiscounts (string $discounts)
 
magic $this setTotalDiscountsSet (string $set)
 
magic $this setTotalLineItemsPrice (number $price)
 
magic $this setTotalLineItemsPriceSet (string $set)
 
magic $this setTotalPriceSet (string $set)
 
magic $this setTotalTaxSet (string $set)
 
magic $this setTotalTipReceived (string $received)
 
magic $this setTotalWeight (string $weight)
 
- Public Methods inherited from AbstractOrder
magic null Address getBillingAddress ()
 
magic string getCreatedAt ()
 
magic string getCurrency ()
 
magic null Customer getCustomer ()
 
magic string getEmail ()
 
magic OrderItem[] getLineItems ()
 
magic string getName ()
 
magic string getNote ()
 
magic array[] getNoteAttributes ()
 name-value "hash" More...
 
magic null Address getShippingAddress ()
 
magic string getSubtotalPrice ()
 
magic string getTags ()
 
magic Tax[] getTaxLines ()
 
magic string getTotalPrice ()
 
magic string getTotalTax ()
 
magic string getUpdatedAt ()
 
magic bool hasTaxesIncluded ()
 
magic $this setBillingAddress (?Address $address)
 
magic $this setCurrency (string $iso4217)
 
magic $this setCustomer (?Customer $customer)
 
magic $this setEmail (string $email)
 
magic $this setName (string $name)
 
magic $this setNote (string $note)
 
magic $this setNoteAttributes (array[] $hash)
 
magic $this setShippingAddress (?Address $address)
 
magic $this setSubtotalPrice (string $price)
 
magic $this setTags (string $csv)
 
magic $this setTaxesIncluded (bool $included)
 
magic $this setTotalPrice (string $price)
 
magic $this setTotalTax (string $amount)
 
- Public Methods inherited from AbstractEntity
string __toString ()
 
null string getId ()
 
string[] getPoolKeys ()
 
bool hasId ()
 
$this reload ()
 Fully reloads the entity from Shopify. More...
 
- Public Methods inherited from Data
mixed __call (string $method, array $args)
 
 __construct ($caller, array $data=[])
 
string serialize ()
 Dehydrated JSON encode. More...
 
array toArray ()
 
void unserialize ($serialized)
 
- Public Methods inherited from MetafieldTrait
Metafield[] getMetafields ()
 
Metafield newMetafield ()
 Factory. More...
 
- Public Methods inherited from CreateTrait
$this create ()
 
- Public Methods inherited from DeleteTrait
void delete ()
 
- Public Methods inherited from UpdateTrait
$this update ()
 

Additional Inherited Members

- Protected Properties inherited from Data
Api $api
 
Pool $pool
 
- Public Static Methods inherited from AbstractEntity
static null self load ($caller, string $id, array $query=[])
 
static self[] loadAll ($caller, string $path, array $query=[])
 
- Protected Methods inherited from AbstractEntity
null AbstractEntity _container ()
 The container/owner object, if any. More...
 
mixed _get (string $field)
 Lazy-loads missing fields. More...
 
void _onDelete ()
 
void _onSave ()
 
void _reload (string $field)
 
- Protected Methods inherited from Data
mixed _hydrate (string $class, $item)
 A factory that also hydrates / caches entities. More...
 
array _select ($subject, callable $filter,... $args)
 Magic method: selectField(callable $filter) More...
 
$this _setData (array $data)
 Clears all diffs and sets all data, hydrating mapped fields. More...
 
$this _setField (string $field, $value)
 Sets a value, hydrating if mapped, and clears the diff. More...
 
- Protected Methods inherited from MetafieldTrait
string _metafieldType ()
 
- Protected Methods inherited from CreateTrait
string _dir ()
 The POST directory. More...
 

Properties

◆ MAP

const MAP
Initial value:
= parent::MAP + [
'discount_applications' => [AppliedDiscount::class],
'discount_codes' => [Discount::class],
'fulfillments' => [Fulfillment::class],
'refunds' => [Refund::class],
'shipping_lines' => [Shipping::class],
]

Methods

◆ cancel()

$this cancel ( )

Cancels the order.

Applicable refunds must be issued before cancellation.

Returns
$this

◆ close()

$this close ( )

Closes the order.

Returns
$this

◆ getAppId()

magic string getAppId ( )
Returns
string

◆ getBrowserIp()

magic string getBrowserIp ( )
Returns
string

◆ getBuyerAcceptsMarketing()

magic bool getBuyerAcceptsMarketing ( )
Returns
bool

◆ getCancelledAt()

magic string getCancelledAt ( )
Returns
string

◆ getCancelReason()

magic string getCancelReason ( )
Returns
string

◆ getCartToken()

magic string getCartToken ( )
Returns
string

◆ getClientDetails()

magic string getClientDetails ( )
Returns
string

◆ getClosedAt()

magic string getClosedAt ( )
Returns
string

◆ getCurrentTotalDutiesSet()

magic string getCurrentTotalDutiesSet ( )
Returns
string

◆ getCustomerLocale()

magic string getCustomerLocale ( )
Returns
string

◆ getDiscountApplications()

magic AppliedDiscount [] getDiscountApplications ( )
Returns
AppliedDiscount[]

◆ getDiscountCodes()

magic Discount [] getDiscountCodes ( )
Returns
Discount[]

◆ getFinancialStatus()

magic string getFinancialStatus ( )
Returns
string

◆ getFulfillments()

magic Fulfillment [] getFulfillments ( )
Returns
Fulfillment[]

◆ getFulfillmentStatus()

magic string getFulfillmentStatus ( )
Returns
string

◆ getLandingSite()

magic string getLandingSite ( )
Returns
string

◆ getLocationId()

magic string getLocationId ( )
Returns
string

◆ getNumber()

magic string getNumber ( )
Returns
string

◆ getOrderNumber()

magic string getOrderNumber ( )
Returns
string

◆ getOrderStatusUrl()

magic string getOrderStatusUrl ( )
Returns
string

◆ getOriginalTotalDutiesSet()

magic string getOriginalTotalDutiesSet ( )
Returns
string

◆ getPaymentGatewayNames()

magic string [] getPaymentGatewayNames ( )
Returns
string[]

◆ getPhone()

magic string getPhone ( )
Returns
string

◆ getPresentmentCurrency()

magic string getPresentmentCurrency ( )
Returns
string

◆ getProcessedAt()

magic string getProcessedAt ( )
Returns
string

◆ getProcessingMethod()

magic string getProcessingMethod ( )
Returns
string

◆ getReferringSite()

magic string getReferringSite ( )
Returns
string

◆ getRefunds()

magic Refund [] getRefunds ( )
Returns
Refund[]

◆ getShippingLines()

magic Shipping [] getShippingLines ( )
Returns
Shipping[]

◆ getSourceName()

magic string getSourceName ( )
Returns
string

◆ getSubtotalPriceSet()

magic string getSubtotalPriceSet ( )
Returns
string

◆ getTaxesIncluded()

magic string getTaxesIncluded ( )
Returns
string

◆ getToken()

magic string getToken ( )
Returns
string

◆ getTotalDiscounts()

magic string getTotalDiscounts ( )
Returns
string

◆ getTotalDiscountsSet()

magic string getTotalDiscountsSet ( )
Returns
string

◆ getTotalLineItemsPrice()

magic number getTotalLineItemsPrice ( )
Returns
number

◆ getTotalLineItemsPriceSet()

magic string getTotalLineItemsPriceSet ( )
Returns
string

◆ getTotalPriceSet()

magic string getTotalPriceSet ( )
Returns
string

◆ getTotalTaxSet()

magic string getTotalTaxSet ( )
Returns
string

◆ getTotalTipReceived()

magic string getTotalTipReceived ( )
Returns
string

◆ getTotalWeight()

magic string getTotalWeight ( )
Returns
string

◆ getUserId()

magic string getUserId ( )

staff account id

Returns
string

◆ hasDiscountApplications()

magic bool hasDiscountApplications ( )
Returns
bool

◆ hasDiscountCodes()

magic bool hasDiscountCodes ( )
Returns
bool

◆ hasFulfillments()

magic bool hasFulfillments ( )
Returns
bool

◆ hasNoteAttributes()

magic bool hasNoteAttributes ( )
Returns
bool

◆ hasPaymentGatewayNames()

magic bool hasPaymentGatewayNames ( )
Returns
bool

◆ hasRefunds()

magic bool hasRefunds ( )
Returns
bool

◆ hasShippingLines()

magic bool hasShippingLines ( )
Returns
bool

◆ hasTaxLines()

magic bool hasTaxLines ( )
Returns
bool

◆ isTest()

magic bool isTest ( )
Returns
bool

◆ newDiscount()

Discount newDiscount ( )
Returns
Discount

◆ newFulfillment()

Fulfillment newFulfillment ( )
Returns
Fulfillment

◆ newRefund()

Refund newRefund ( )
Returns
Refund

◆ newShipping()

Shipping newShipping ( )
Returns
Shipping

◆ reopen()

$this reopen ( )

Reopens a closed order.

Returns
$this

◆ setBuyerAcceptsMarketing()

magic $this setBuyerAcceptsMarketing ( bool  $marketing)
Returns
$this

◆ setCancelReason()

magic $this setCancelReason ( string  $reason)
Depends:
create-only
Returns
$this

◆ setDiscountCodes()

magic $this setDiscountCodes ( Discount[]  $codes)
Depends:
create-only
Returns
$this

◆ setFinancialStatus()

magic $this setFinancialStatus ( string  $status)
Depends:
create-only
Returns
$this

◆ setFulfillments()

magic $this setFulfillments ( string[]  $fulfillments)
Depends:
create-only
Returns
$this

◆ setFulfillmentStatus()

magic $this setFulfillmentStatus ( string  $status)
Depends:
create-only
Returns
$this

◆ setInventoryBehavior()

magic $this setInventoryBehavior ( string  $behavior)
Depends:
create-only
Returns
$this

◆ setLocationId()

magic $this setLocationId ( string  $id)
Depends:
create-only
Returns
$this

◆ setPhone()

magic $this setPhone ( string  $phone)
Returns
$this

◆ setPresentmentCurrency()

magic $this setPresentmentCurrency ( string  $currency)
Depends:
create-only
Returns
$this

◆ setProcessedAt()

magic $this setProcessedAt ( string  $iso8601)
Depends:
create-only, historical creation date
Returns
$this

◆ setReferringSite()

magic $this setReferringSite ( string  $site)
Returns
$this

◆ setSendFulfillmentReceipt()

magic $this setSendFulfillmentReceipt ( bool  $receipt)
Depends:
create-only
Returns
$this

◆ setSendReceipt()

magic $this setSendReceipt ( bool  $receipt)
Depends:
create-only
Returns
$this

◆ setShippingLines()

magic $this setShippingLines ( Shipping[]  $lines)
Depends:
create-only
Returns
$this

◆ setSourceName()

magic $this setSourceName ( string  $name)
Depends:
create-only
Returns
$this

◆ setSubtotalPriceSet()

magic $this setSubtotalPriceSet ( string  $set)
Depends:
create-only
Returns
$this

◆ setTaxLines()

magic $this setTaxLines ( Tax[]  $taxes)
Depends:
create-only
Returns
$this

Reimplemented from AbstractOrder.

◆ setTest()

magic $this setTest ( bool  $test)
Depends:
create-only
Returns
$this

◆ setTotalDiscounts()

magic $this setTotalDiscounts ( string  $discounts)
Depends:
create-only
Returns
$this

◆ setTotalDiscountsSet()

magic $this setTotalDiscountsSet ( string  $set)
Depends:
create-only
Returns
$this

◆ setTotalLineItemsPrice()

magic $this setTotalLineItemsPrice ( number  $price)
Depends:
create-only
Returns
$this

◆ setTotalLineItemsPriceSet()

magic $this setTotalLineItemsPriceSet ( string  $set)
Depends:
create-only
Returns
$this

◆ setTotalPriceSet()

magic $this setTotalPriceSet ( string  $set)
Depends:
create-only
Returns
$this

◆ setTotalTaxSet()

magic $this setTotalTaxSet ( string  $set)
Depends:
create-only
Returns
$this

◆ setTotalTipReceived()

magic $this setTotalTipReceived ( string  $received)
Depends:
create-only
Returns
$this

◆ setTotalWeight()

magic $this setTotalWeight ( string  $weight)
Depends:
create-only
Returns
$this