JDBC Driver for WooCommerce

Build 24.0.9062

ProductVariations

Retrieve and modify product variations.

Table Specific Information

Select

WooCommerce allows only a small subset of columns to be used in the WHERE clause of a SELECT query. These columns support only the = comparison, unless stated otherwise. The available column for this table is: Id, Sku, Price, OnSale, Status, TaxClass, StockStatus, ProductId, ParentId. The price filter can be used with the <, > conditions and may be used twice to specify a range. All other columns are processed client side.

SELECT * FROM ProductVariations WHERE Id = 4
SELECT * FROM ProductVariations WHERE Price < 14.99 AND Price > 11.99 AND OnSale = true

Update

To introduce new metadata fields which are not present in the schema, the 'metadata' pseudocolumn can be used. The update below will create two new metadata fields with keys 'key1' and 'key2' and set their respective values. If any of the keys specified already exists, its value will be updated.

UPDATE ProductVariations SET metadata = 'key1:val1, key2:val2' WHERE ID = 58 AND ProductID = 80

To update Stock information, you must set ManageStock to true. For example:

UPDATE ProductVariations SET StockQuantity = 6, ManageStock = true WHERE ID = 58 AND ProductID = 80

Insert

The following attribute is required when performing an insert: ProductId.

INSERT INTO ProductVariations (ProductId) VALUES (167)

Columns

Name Type ReadOnly References Description
Id [KEY] Long True

Unique identifier for the resource.

DateCreated Datetime True

The date the variation was created, in the site's timezone.

DateModified Datetime True

The date the variation was last modified, in the site's timezone.

Description String False

Variation description.

Permalink String True

Variation URL.

Sku String False

Unique identifier.

Price String True

Current variation price.

RegularPrice String False

Variation regular price.

SalePrice String False

Variation sale price.

DateOnSaleFrom Datetime False

Start date of sale price, in the site's timezone.

DateOnSaleTo Datetime False

End date of sale price, in the site's timezone.

OnSale Boolean True

Shows if the variation is on sale.

Status String False

Variation status. Options: draft, pending, private and publish. Defaults to publish.

Purchasable Boolean True

Shows if the variation can be bought.

Virtual Boolean False

If the variation is virtual. Defaults to false.

Downloadable Boolean False

If the variation is downloadable. Defaults to false.

DownloadsAggregate String False

List of downloadable files. See Product variation - Downloads properties

DownloadLimit Integer False

Number of times downloadable files can be downloaded after purchase. Defaults to -1.

DownloadExpiry Integer False

Number of days until access to downloadable files expires. Defaults to -1.

TaxStatus String False

Tax status. Options: taxable, shipping and none. Defaults to taxable.

TaxClass String False

Tax class.

ManageStock String False

Stock management at variation level. Defaults to false. If the stock is managed by product and not variaation then the value is parent.

StockQuantity Integer False

Stock quantity.

StockStatus String False

Controls the stock status of the product. Options: instock, outofstock, onbackorder. Defaults to instock.

Backorders String False

If managing stock, this controls if backorders are allowed. Options: no, notify and yes. Defaults to no.

BackordersAllowed Boolean True

Shows if backorders are allowed.

Backordered Boolean True

Shows if the variation is on backordered.

Weight String False

Variation weight.

ShippingClass String False

Shipping class slug.

ShippingClassId String True

Shipping class ID.

AttributesAggregate String False

List of attributes. See Product variation - Attributes properties

MenuOrder Integer False

Menu order, used to custom sort products.

MetaData String False

Meta data. See Product variation - Meta data properties

DimensionsLength String False

Variation length.

DimensionsWidth String False

Variation width.

DimensionsHeight String False

Variation height.

ImageId Long False

Image ID.

ImageDateCreated Datetime True

The date the image was created, in the site's timezone.

ImageDateModified Datetime True

The date the image was last modified, in the site's timezone.

ImageSrc String False

Image URL.

ImageName String False

Image name.

ImageAlt String False

Image alternative text.

ProductId Long False

Products.Id

Id of the product.

ParentId Long False

The id of the parent, filtered server side.

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9062