Files
medusa-store/www/apps/docs/content/references/js-client/classes/AdminVariantsResource.mdx
github-actions[bot] f35fcb810f chore(docs): Generated References (#5593)
* chore(docs): Generated References (automated)

* fix sidebar and links

* removed reflection path section

---------

Co-authored-by: shahednasser <shahednasser@users.noreply.github.com>
Co-authored-by: Shahed nasser <shahednasser@gmail.com>
2023-11-09 20:23:25 +02:00

1192 lines
43 KiB
Plaintext

---
displayed_sidebar: jsClientSidebar
slug: /references/js-client/AdminVariantsResource
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# AdminVariantsResource
This class is used to send requests to [Admin Product Variant API Routes](https://docs.medusajs.com/api/admin#product-variants). All its method
are available in the JS Client under the `medusa.admin.variants` property.
All methods in this class require [user authentication](AdminAuthResource.mdx#createsession).
Product variants are the actual salable item in your store. Each variant is a combination of the different option values available on the product.
Product variants can be managed through [AdminProductsResource](AdminProductsResource.mdx).
Related Guide: [How to manage product variants](https://docs.medusajs.com/modules/products/admin/manage-products#manage-product-variants).
## Methods
### getInventory
Retrieve the available inventory of a product variant.
#### Example
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.variants.getInventory(variantId).then(({ variant }) => {
console.log(variant.inventory, variant.sales_channel_availability)
})
```
#### Parameters
<ParameterTypes parameters={[
{
"name": "variantId",
"type": "`string`",
"description": "The product variant's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "customHeaders",
"type": "Record<`string`, `any`\\>",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[`ResponsePromise`](../modules/internal.mdx#responsepromise)<[`AdminGetVariantsVariantInventoryRes`](../modules/internal.mdx#admingetvariantsvariantinventoryres)\\>",
"optional": false,
"defaultValue": "",
"description": "Resolves to the inventory details of the product variant.",
"expandable": false,
"children": [
{
"name": "AdminGetVariantsVariantInventoryRes",
"type": "`object`",
"description": "The variant's inventory details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "variant",
"type": "[`VariantInventory`](../modules/internal.mdx#variantinventory)",
"description": "The product variant's inventory details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "id",
"type": "`string`",
"description": "the ID of the variant",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory",
"type": "[`ResponseInventoryItem`](../internal/modules/internal.internal.mdx#responseinventoryitem)[]",
"description": "The inventory details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sales_channel_availability",
"type": "{ `available_quantity`: `number` ; `channel_id`: `string` ; `channel_name`: `string` }[]",
"description": "Details about the variant's inventory availability in sales channels.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]
}
]} />
___
### list
Retrieve a list of product variants. The product variant can be filtered by fields such as `id` or `title` passed in the `query` parameter. The product variant can also be paginated.
#### Example
To list product variants:
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.variants.list().then(({ variants, limit, offset, count }) => {
console.log(variants.length)
})
```
To specify relations that should be retrieved within the product variants:
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.variants
.list({
expand: "options",
})
.then(({ variants, limit, offset, count }) => {
console.log(variants.length)
})
```
By default, only the first `100` records are retrieved. You can control pagination by specifying the `limit` and `offset` properties:
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.variants
.list({
expand: "options",
limit,
offset,
})
.then(({ variants, limit, offset, count }) => {
console.log(variants.length)
})
```
#### Parameters
<ParameterTypes parameters={[
{
"name": "query",
"type": "[`AdminGetVariantsParams`](../internal/classes/internal.AdminGetVariantsParams.mdx)",
"description": "Filters and pagination configurations to apply on the retrieved product variants.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "cart_id",
"type": "`string`",
"description": "Retrieve prices for a cart ID.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "currency_code",
"type": "`string`",
"description": "Retrieve prices for a currency code.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "customer_id",
"type": "`string`",
"description": "Retrieve prices for a customer ID.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "expand",
"type": "`string`",
"description": "Comma-separated relations that should be expanded in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "`string`",
"description": "Comma-separated fields that should be included in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string` \\| `string`[]",
"description": "IDs to filter product variants by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_quantity",
"type": "`number` \\| [`NumericalComparisonOperator`](../internal/classes/internal.NumericalComparisonOperator.mdx)",
"description": "Number filters to apply on product variants' `inventory_quantity` field.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "Limit the number of items returned in the list.",
"optional": true,
"defaultValue": "20",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "The number of items to skip when retrieving a list.",
"optional": true,
"defaultValue": "0",
"expandable": false,
"children": []
},
{
"name": "q",
"type": "`string`",
"description": "Search term to search product variants' IDs.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "region_id",
"type": "`string`",
"description": "Retrieve prices for a region ID.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string` \\| `string`[]",
"description": "Titles to filter product variants by.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "customHeaders",
"type": "Record<`string`, `any`\\>",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[`ResponsePromise`](../modules/internal.mdx#responsepromise)<[`AdminVariantsListRes`](../modules/internal.mdx#adminvariantslistres)\\>",
"optional": false,
"defaultValue": "",
"description": "Resolves to the list of product variants with pagination fields.",
"expandable": false,
"children": [
{
"name": "AdminVariantsListRes",
"type": "[`PaginatedResponse`](../internal/interfaces/internal.PaginatedResponse.mdx) & { `variants`: [`PricedVariant`](../modules/internal.mdx#pricedvariant)[] }",
"description": "The list of variants with pagination fields.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "count",
"type": "`number`",
"description": "The total number of items available.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "limit",
"type": "`number`",
"description": "The maximum number of items that can be returned in the list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "offset",
"type": "`number`",
"description": "The number of items skipped before the returned items in the list.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variants",
"type": "[`PricedVariant`](../modules/internal.mdx#pricedvariant)[]",
"description": "An array of product variant details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "allow_backorder",
"type": "`boolean`",
"description": "Whether the Product Variant should be purchasable when `inventory_quantity` is 0.",
"optional": false,
"defaultValue": "false",
"expandable": false,
"children": []
},
{
"name": "barcode",
"type": "``null`` \\| `string`",
"description": "A generic field for a GTIN number that can be used to identify the Product Variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "``null`` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ean",
"type": "``null`` \\| `string`",
"description": "An EAN barcode number that can be used to identify the Product Variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "``null`` \\| `number`",
"description": "The height of the Product Variant. May be used in shipping rate calculations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "``null`` \\| `string`",
"description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The product variant's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_items",
"type": "[`ProductVariantInventoryItem`](../internal/classes/internal.internal.ProductVariantInventoryItem.mdx)[]",
"description": "The details inventory items of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "inventory_quantity",
"type": "`number`",
"description": "The current quantity of the item that is stocked.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "``null`` \\| `number`",
"description": "The length of the Product Variant. May be used in shipping rate calculations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manage_inventory",
"type": "`boolean`",
"description": "Whether Medusa should manage inventory for the Product Variant.",
"optional": false,
"defaultValue": "true",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "``null`` \\| `string`",
"description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "``null`` \\| Record<`string`, `unknown`\\>",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "``null`` \\| `string`",
"description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[`ProductOptionValue`](../internal/classes/internal.internal.ProductOptionValue.mdx)[]",
"description": "The details of the product options that this product variant defines values for.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "origin_country",
"type": "``null`` \\| `string`",
"description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "prices",
"type": "[`MoneyAmount`](../internal/classes/internal.internal.MoneyAmount.mdx)[]",
"description": "The details of the prices of the Product Variant, each represented as a Money Amount. Each Money Amount represents a price in a given currency or a specific Region.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "product",
"type": "[`Product`](../internal/classes/internal.Product.mdx)",
"description": "The details of the product that the product variant belongs to.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "product_id",
"type": "`string`",
"description": "The ID of the product that the product variant belongs to.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "purchasable",
"type": "`boolean`",
"description": "Only used with the inventory modules. A boolean value indicating whether the Product Variant is purchasable. A variant is purchasable if: - inventory is not managed - it has no inventory items - it is in stock - it is backorderable.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "``null`` \\| `string`",
"description": "The unique stock keeping unit used to identify the Product Variant. This will usually be a unique identifer for the item that is to be shipped, and can be referenced across multiple systems.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "A title that can be displayed for easy identification of the Product Variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "upc",
"type": "``null`` \\| `string`",
"description": "A UPC barcode number that can be used to identify the Product Variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant_rank",
"type": "``null`` \\| `number`",
"description": "The ranking of this variant",
"optional": false,
"defaultValue": "0",
"expandable": false,
"children": []
},
{
"name": "weight",
"type": "``null`` \\| `number`",
"description": "The weight of the Product Variant. May be used in shipping rate calculations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "``null`` \\| `number`",
"description": "The width of the Product Variant. May be used in shipping rate calculations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "calculated_price",
"type": "`number` \\| ``null``",
"description": "The lowest price among the retrieved prices.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "calculated_price_includes_tax",
"type": "`boolean` \\| ``null``",
"description": "Whether the `calculated_price` field includes taxes.",
"optional": true,
"defaultValue": "",
"expandable": false,
"featureFlag": "tax_inclusive_pricing",
"children": []
},
{
"name": "calculated_price_type",
"type": "`string` \\| ``null``",
"description": "Either `default` if the `calculated_price` is the original price, or the type of the price list applied, if any.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "original_price",
"type": "`number` \\| ``null``",
"description": "The original price of the variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "original_price_includes_tax",
"type": "`boolean` \\| ``null``",
"description": "Whether the `original_price` field includes taxes.",
"optional": true,
"defaultValue": "",
"expandable": false,
"featureFlag": "tax_inclusive_pricing",
"children": []
},
{
"name": "prices",
"type": "[`MoneyAmount`](../internal/classes/internal.internal.MoneyAmount.mdx)[]",
"description": "The list of prices.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "calculated_price_incl_tax",
"type": "`number` \\| ``null``",
"description": "The price after applying the tax amount on the calculated price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "calculated_tax",
"type": "`number` \\| ``null``",
"description": "The tax amount applied to the calculated price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "original_price_incl_tax",
"type": "`number` \\| ``null``",
"description": "The price after applying the tax amount on the original price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "original_tax",
"type": "`number` \\| ``null``",
"description": "The tax amount applied to the original price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "tax_rates",
"type": "[`TaxServiceRate`](../modules/internal.mdx#taxservicerate)[] \\| ``null``",
"description": "The list of tax rates.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]
}
]} />
___
### retrieve
Retrieve a product variant's details.
#### Example
A simple example that retrieves a product variant by its ID:
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.variants.retrieve(variantId).then(({ variant }) => {
console.log(variant.id)
})
```
To specify relations that should be retrieved:
```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.variants
.retrieve(variantId, {
expand: "options",
})
.then(({ variant }) => {
console.log(variant.id)
})
```
#### Parameters
<ParameterTypes parameters={[
{
"name": "id",
"type": "`string`",
"description": "The product variant's ID.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "query",
"type": "[`AdminGetVariantParams`](../internal/classes/internal.AdminGetVariantParams.mdx)",
"description": "Configurations to apply on the retrieved product variant.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "expand",
"type": "`string`",
"description": "Comma-separated relations that should be expanded in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "fields",
"type": "`string`",
"description": "Comma-separated fields that should be included in the returned data.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]
},
{
"name": "customHeaders",
"type": "Record<`string`, `any`\\>",
"description": "Custom headers to attach to the request.",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
#### Returns
<ParameterTypes parameters={[
{
"name": "ResponsePromise",
"type": "[`ResponsePromise`](../modules/internal.mdx#responsepromise)<[`AdminVariantsRes`](../modules/internal.mdx#adminvariantsres)\\>",
"optional": false,
"defaultValue": "",
"description": "Resolves to the product variant's details.",
"expandable": false,
"children": [
{
"name": "AdminVariantsRes",
"type": "`object`",
"description": "The product variant's details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "variant",
"type": "[`PricedVariant`](../modules/internal.mdx#pricedvariant)",
"description": "Product variant's details.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": [
{
"name": "allow_backorder",
"type": "`boolean`",
"description": "Whether the Product Variant should be purchasable when `inventory_quantity` is 0.",
"optional": false,
"defaultValue": "false",
"expandable": false,
"children": []
},
{
"name": "barcode",
"type": "``null`` \\| `string`",
"description": "A generic field for a GTIN number that can be used to identify the Product Variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "created_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was created.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "deleted_at",
"type": "``null`` \\| `Date`",
"description": "The date with timezone at which the resource was deleted.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "ean",
"type": "``null`` \\| `string`",
"description": "An EAN barcode number that can be used to identify the Product Variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "height",
"type": "``null`` \\| `number`",
"description": "The height of the Product Variant. May be used in shipping rate calculations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "hs_code",
"type": "``null`` \\| `string`",
"description": "The Harmonized System code of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "id",
"type": "`string`",
"description": "The product variant's ID",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "inventory_items",
"type": "[`ProductVariantInventoryItem`](../internal/classes/internal.internal.ProductVariantInventoryItem.mdx)[]",
"description": "The details inventory items of the product variant.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "inventory_quantity",
"type": "`number`",
"description": "The current quantity of the item that is stocked.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "length",
"type": "``null`` \\| `number`",
"description": "The length of the Product Variant. May be used in shipping rate calculations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manage_inventory",
"type": "`boolean`",
"description": "Whether Medusa should manage inventory for the Product Variant.",
"optional": false,
"defaultValue": "true",
"expandable": false,
"children": []
},
{
"name": "material",
"type": "``null`` \\| `string`",
"description": "The material and composition that the Product Variant is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "metadata",
"type": "``null`` \\| Record<`string`, `unknown`\\>",
"description": "An optional key-value map with additional details",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "mid_code",
"type": "``null`` \\| `string`",
"description": "The Manufacturers Identification code that identifies the manufacturer of the Product Variant. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "options",
"type": "[`ProductOptionValue`](../internal/classes/internal.internal.ProductOptionValue.mdx)[]",
"description": "The details of the product options that this product variant defines values for.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "origin_country",
"type": "``null`` \\| `string`",
"description": "The country in which the Product Variant was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "prices",
"type": "[`MoneyAmount`](../internal/classes/internal.internal.MoneyAmount.mdx)[]",
"description": "The details of the prices of the Product Variant, each represented as a Money Amount. Each Money Amount represents a price in a given currency or a specific Region.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "product",
"type": "[`Product`](../internal/classes/internal.Product.mdx)",
"description": "The details of the product that the product variant belongs to.",
"optional": false,
"defaultValue": "",
"expandable": true,
"children": []
},
{
"name": "product_id",
"type": "`string`",
"description": "The ID of the product that the product variant belongs to.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "purchasable",
"type": "`boolean`",
"description": "Only used with the inventory modules. A boolean value indicating whether the Product Variant is purchasable. A variant is purchasable if: - inventory is not managed - it has no inventory items - it is in stock - it is backorderable.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "sku",
"type": "``null`` \\| `string`",
"description": "The unique stock keeping unit used to identify the Product Variant. This will usually be a unique identifer for the item that is to be shipped, and can be referenced across multiple systems.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "title",
"type": "`string`",
"description": "A title that can be displayed for easy identification of the Product Variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "upc",
"type": "``null`` \\| `string`",
"description": "A UPC barcode number that can be used to identify the Product Variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "updated_at",
"type": "`Date`",
"description": "The date with timezone at which the resource was updated.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "variant_rank",
"type": "``null`` \\| `number`",
"description": "The ranking of this variant",
"optional": false,
"defaultValue": "0",
"expandable": false,
"children": []
},
{
"name": "weight",
"type": "``null`` \\| `number`",
"description": "The weight of the Product Variant. May be used in shipping rate calculations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "width",
"type": "``null`` \\| `number`",
"description": "The width of the Product Variant. May be used in shipping rate calculations.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "calculated_price",
"type": "`number` \\| ``null``",
"description": "The lowest price among the retrieved prices.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "calculated_price_includes_tax",
"type": "`boolean` \\| ``null``",
"description": "Whether the `calculated_price` field includes taxes.",
"optional": true,
"defaultValue": "",
"expandable": false,
"featureFlag": "tax_inclusive_pricing",
"children": []
},
{
"name": "calculated_price_type",
"type": "`string` \\| ``null``",
"description": "Either `default` if the `calculated_price` is the original price, or the type of the price list applied, if any.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "original_price",
"type": "`number` \\| ``null``",
"description": "The original price of the variant.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "original_price_includes_tax",
"type": "`boolean` \\| ``null``",
"description": "Whether the `original_price` field includes taxes.",
"optional": true,
"defaultValue": "",
"expandable": false,
"featureFlag": "tax_inclusive_pricing",
"children": []
},
{
"name": "prices",
"type": "[`MoneyAmount`](../internal/classes/internal.internal.MoneyAmount.mdx)[]",
"description": "The list of prices.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "calculated_price_incl_tax",
"type": "`number` \\| ``null``",
"description": "The price after applying the tax amount on the calculated price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "calculated_tax",
"type": "`number` \\| ``null``",
"description": "The tax amount applied to the calculated price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "original_price_incl_tax",
"type": "`number` \\| ``null``",
"description": "The price after applying the tax amount on the original price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "original_tax",
"type": "`number` \\| ``null``",
"description": "The tax amount applied to the original price.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "tax_rates",
"type": "[`TaxServiceRate`](../modules/internal.mdx#taxservicerate)[] \\| ``null``",
"description": "The list of tax rates.",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]
}
]
}
]
}
]} />