Order Methods

An order object holds shopping cart data and methods for placing the order. This object is different from a NetSuite order record, because it holds information for the given shopping session only.

The following Order methods are available:

addFreeGiftItem(item)

Adds the eligible item to the cart and marks it as a free item.

Parameters

Note: quantity can be a negative number.

Returns

String - the orderitemid of added item.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

addItem(item)

Adds an item to order.

Note:

If your selected Out Of Stock Behavior option is Disallow back orders but display out-of-stock message or Remove out-of-stock items from store, you might still be able to add an out of stock item to your cart using the addItem(item) order method. However, when you try to place the order with such out of stock item in your shopping cart, an error message is displayed and you will not be able to place the order successfully.

Parameters

Note: quantity can be a negative number.

Returns

String - the orderitemid of added item.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

addItems(items)

Adds multiple items to cart/order within a single request.

Note:

If your selected Out Of Stock Behavior option is Disallow back orders but display out-of-stock message or Remove out-of-stock items from store, you might still be able to add out of stock items to your cart using the addItems(items) order method. However, when you try to place the order with such out of stock items in your shopping cart, an error message is displayed and you will not be able to place the order successfully.

Parameters
Returns

String - the orderitemid of added items.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

applyGiftCertificate(giftcertificate)

Applies given gift certificate to the order.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

applyPromotionCode(promocode)

Applies given promotion code to the order.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

estimateShippingCost(address)

Gets estimated shipping cost for given address.

Note:

Estimated shipping cost depends on order's shipping method, enabling of shipping estimator on site administration page, and whether order requires shipping.

Parameters
Returns

Number

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

setItemExcludedFromShipping(cartItemId,excluded)

Identifies when an item on an order is excluded from shipping.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getAppliedGiftCertificate(giftcertificate, fields)

Gets specified gift certificate.

Parameters
Returns

Object of type giftcertificate.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getAppliedGiftCertificates(fields)

Gets all applied gift certificates.

Parameters
Returns

Array of objects of type giftcertificate

Supported Domains

Checkout

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getAppliedPromotionCode(promocode, fields)

Gets specified promotion code.

Parameters
Returns

Object of type promocode

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getAppliedPromotionCodes(fields)

Gets all applied promotion codes.

Parameters
Returns

Array of objects of type promocode.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getAvailableShippingMethods(orderLineIds, shipAddressId)

Returns available shipping methods and addresses for the given item in the order.

Note:

The setEnableItemLineShipping() flag must be set before using this method. See setEnableItemLineShipping().

Parameters
Returns

Array of objects of type shipmethod.

Supported Domains

Checkout

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getAvailableShippingMethod(shipmethodid,fields)

Gets specified shipping method.

Parameters
Returns

Object of type shipmethod.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getAvailableShippingMethods(fields)

Gets all available shipping methods.

Parameters
Returns

Array of objects of type shipmethod.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getBillingAddress()

Gets billing address for order.

Parameters

No parameters to set.

Returns

Object of type address.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

getCustomFields()

Gets custom fields on order record.

Parameters

No parameters to set.

Returns

Object with custom field names.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getCustomFieldValues()

Gets custom field values for current order.

Parameters

No parameters to set.

Returns

Object with custom field values.

Supported Domains

Checkout, Shopping

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

getDeviceFingerPrintingHtml()

Sets device finger printing for Cybersource for the device a shopper is logged in from when accessing a web store. This can be used with the Cybersource payment gateway for added site security. The API call must be made in the last step of checkout. For more details on device fingerprinting in Commerce web stores, see Device Fingerprinting.

Parameters

No parameters to set.

Returns

Returns an HTML string that needs to be rendered on the last page of a checkout that includes the Submit Order button.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

getEligibleFreeGiftItems()

Gets a list of all Free Item promotions that are currently applied. It also gets the Item IDs of all the free items.

Parameters

No parameters to set.

Returns

Array of objects with the following fields:

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getFieldValues(fields)

Gets standard field values for the current order.

Parameters
Returns

Object of type order.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getItem(orderitemid, fields)

Gets specified order item.

Parameters
Returns

Object of type orderitem.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getItemOption(orderitemid,fields)

Gets item option for specified order item.

Parameters
Returns

The options field from the object of type orderitem.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getItems(bConsolidated), getItems(fields, bConsolidated)

Used to configure multiple shipping routes on web orders. Depending on the value for bConsolidated, order items are returned in either a split view or in a consolidated view.

For example, displaying an unconsolidated view of all the items in the cart allows shoppers to select the shipping address for each item. You can then use the consolidated view to display items to be shipped, grouped by shipping address.

Note:

The setEnableItemLineShipping() flag must be set before using this method. See setEnableItemLineShipping().

Parameters
Returns

Object of type orderitem.

Supported Domains

Checkout

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getItems(fields)

Gets order items.

Parameters
Returns

Array of objects of type orderitem.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getItemShippingFieldValues(orderitemid)

Gets shipping field values for specified order item. This API is only available when the Multiple Shipping Routes feature is enabled.

Parameters
Returns

Object with fields:

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

getOrderSummary(fields)

Gets the order summary.

Important:

For the most optimized results, use the itemcount argument with this method. When this method is called with no arguments, all information about the order is returned which results in poor performance.

Example

           var itemcount = nlapiGetWebContainer().getShoppingSession().getOrder().getOrderSummary(['itemcount']); 

        
Parameters
Returns

Object of type ordersummary.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getPayment(fields)

Gets payment details for order.

Parameters
Returns

Object of type payment.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

getPurchaseNumber()

Gets the Purchase order number associated with the order.

Parameters

No parameters to set.

Returns

String

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

getShippingAddress()

Gets shipping address for order.

Parameters

No parameters to set.

Returns

Object of type address

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

getShippingMethod(fields)

Gets shipping method for order.

Parameters
Returns

Object of type shipmethod.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

getSummaryTaxTotals()

Gets details of the tax amount for each type of tax applicable for a sales order. This method works only when the SuiteTax feature is enabled. For information about SuiteTax, see SuiteTax, Working with Taxes using Commerce API and SuiteCommerce SuiteTax Support.

Parameters

No parameters to set.

Returns
  • If SuiteTax is enabled, returns object of type summarytax.

  • If SuiteTax is not enabled, returns error message.

Supported Domains

Checkout, Shopping

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

getTaxDetails(), getTaxDetails(fields)

Gets details of tax applicable for each item in the sales order. Use these methods only if the SuiteTax feature is enabled. For information about SuiteTax, see SuiteTax, Working with Taxes using Commerce API and SuiteCommerce SuiteTax Support.

Parameters
  • fields [optional] Array of field names to be included in returned JSON object; if omitted, all supported fields are returned

Returns
  • If SuiteTax is enabled, returns object of type taxdetails.

    If handling is set up as separate from shipping, returns separate taxdetails objects for shipping and handling. If multiple tax types are applicable to the order, returns one taxdetails object per tax type per item.

  • If SuiteTax is not enabled, returns error message.

Supported Domains

Checkout, Shopping

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

mergeItems(orderLineIds)

Merges the given line items into a single order line item. The given order lines can only differ in quantity and shipping address and method.

Note:

The setEnableItemLineShipping() flag must be set before using this method. See setEnableItemLineShipping().

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Sample Code
          nlapiGetWebContainer().getShoppingSession().getOrder().mergeItems(orderLineIds); 

        

Back to Order Methods | Back to Shopping Objects

recalculateTaxes()

Triggers tax calculation for a sales order. Use this method only if the SuiteTax feature is enabled.

You must call this method to calculate taxes for a sales order every time you need updated tax details. Taxes are not calculated or recalculated unless this method is called.

SuiteTax uses external tax engines to calculate taxes and this can have an impact on performance. You should limit the use of this method to situations where tax recalculation is necessary. For information about SuiteTax, see SuiteTax, Working with Taxes using Commerce API and SuiteCommerce SuiteTax Support.

Parameters

No parameters to set.

Returns
  • If calculation is successful, does not return a value.

  • If calculation fails, returns error message.

  • If SuiteTax is not enabled, returns error message.

Supported Domains

Checkout, Shopping

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

rejectFreeGiftItem(item)

Allows shoppers to reject the free item provided the item is not already in the cart.

Parameters

Note: quantity can be a negative number.

Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

removeAllGiftCertificates()

Removes all gift certificates from an order.

Parameters

No parameters to set.

Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Sample Code
          nlapiGetWebContainer().getShoppingSession().getOrder().removeAllGiftCertificates() 

        

Back to Order Methods | Back to Shopping Objects

removeAllItems()

Removes all items from order.

Parameters

No parameters to set.

Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

removeBillingAddress()

Removes the current billing address from the order.

Parameters

No parameters to set.

Returns

No value returned.

Supported Domains

Checkout

Login Required?

yes

Back to Order Methods | Back to Shopping Objects

removeItem(orderitemid)

Removes specified item from order.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

removeItemOptions(itemlineid)

Removes specified item options from a row in the cart.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

removePayment()

Removes the current payment method for the order.

Parameters

No parameters to set.

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

removePurchaseNumber()

Removes the associated Purchase order number from order.

Parameters

No parameters to set.

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

removePromotionCode(promocode)

Removes specified promotion code from order.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

removeAllPromotionCodes()

Removes all promotion codes from the order.

Parameters

No parameters to set.

Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

removeShippingAddress()

Removes the current shipping address from the order.

Parameters

No parameters to set.

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

removeShippingMethod()

Removes the current shipping method for the order.

Parameters

No parameters to set.

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setBillingAddress(addressid)

Sets the billing address for the order.

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setCardHolderAuthentication(cardHolderAuthentication)

Sets the credit card holder authentication for the order.

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setCustomFieldValues(customfields)

Sets custom field values for order.

Parameters
Important:

Custom fields of the type Document are NOT supported for non-employee external centers.

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setEnableItemLineShipping()

Toggles the item line shipping flag for the current order. This flag must be set prior to using other Multiple Ship To APIs.

Important:

The Multiple Shipping Routes feature is required.

An exception is thrown when:

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Sample Code
          nlapiGetWebContainer().getShoppingSession().getOrder().setEnableItemLineShipping(true); 

        

Back to Order Methods | Back to Shopping Objects

setItemOptions(itemlineid,optionMap)

Updates the item options for a particular cart row.

Parameters
Note:

itemlineid is a combination of item id and set. This is included because of the possibility for multiple quantities of the same item but with different item options.

Returns

itemLineId of the new line with the new item options.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

setItemShippingAddress(orderItemId, shipAddressId)

Sets the shipping address for the given order line item.

Note:

The setEnableItemLineShipping() flag must be set before using this method. See setEnableItemLineShipping().

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Sample Code
          nlapiGetWebContainer().getShoppingSession().getOrder().setItemShippingAddress(orderItemId, shipAddressId); 

        

Back to Order Methods | Back to Shopping Objects

setItemShippingAddress(orderItemIds, shipAddressId)

Sets the shipping address for an array of given order line items.

Note:

The setEnableItemLineShipping() flag must be set before using this method. See setEnableItemLineShipping().

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setItemShippingMethod(orderItemId, shipMethodId)

Sets the shipping method for the given order line item.

Note:

The setEnableItemLineShipping() flag must be set before using this method. See setEnableItemLineShipping().

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Sample Code
          nlapiGetWebContainer().getShoppingSession().getOrder().setItemShippingMethod(orderItemId, shipMethodId); 

        

Back to Order Methods | Back to Shopping Objects

setItemShippingMethod(orderItemIds, shipMethodId)

Sets the shipping method for an array of given order line items.

Note:

The setEnableItemLineShipping() flag must be set before using this method. See setEnableItemLineShipping().

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setPayment(payment)

Sets payment for order; for credit card, creates a new record if internalid not provided.

Parameters
Note:

* Fields are required only for credit card payment methods.

For information about creating non-credit card payment methods, see Alternative Payment Methods and ACH Payments.

Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setPurchaseNumber(purchaseNumber)

Sets the purchase number for the order.

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setShippingAddress(addressid)

Sets the shipping address for the order.

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setShippingMethod(shipmethod)

Sets shipping method for order.

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

setTermsAndConditions(readandagree)

If required by site, sets whether user has read and agreed to terms and conditions.

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

splititem(orderLine)

Splits the given line item into multiple order line items. You can then set a shipping address for each order line.

Note:

The setEnableItemLineShipping() flag must be set before using this method. See setEnableItemLineShipping().

Parameters
Returns

No value returned.

Supported Domains

Checkout

Login Required?

Yes

Sample Code
          nlapiGetWebContainer().getShoppingSession().getOrder().splitItem(orderitem); 

        

Back to Order Methods | Back to Shopping Objects

submit(ordersettings)

Places the shopping order.

Parameters
Returns

Object with fields:

Supported Domains

Checkout

Login Required?

Yes

Back to Order Methods | Back to Shopping Objects

updateItemFulfillmentPreferences(item)

Updates specified item's fulfillment choices for the order.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

updateItemsFulfillmentPreferences(items)

Updates specified items' fulfillment choices for the order.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

updateItemQuantity(item)

Updates specified item's quantity for order.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Back to Order Methods | Back to Shopping Objects

updateItemQuantities(items)

Updates specified items' quantities for order.

Parameters
Returns

No value returned.

Supported Domains

Checkout, Shopping

Login Required?

No

Related Topics:

Understanding Multiple Ship To
Order Methods
ShoppingSession Methods
Customer Methods
PageGenerator Methods
StandardTagLibrary Methods
Shopping Objects

General Notices