SubscriptionLineItems
Retrieves all subscription line items. This view shows data only if the WooCommerce Subscriptions Plugin is enabled.
View-Specific Information
Select
WooCommerce supports server-side filtering only on a limited set of columns in the SubscriptionLineItems view. All other filters are applied client-side. The following columns support server-side filtering with the specified operators:
- SubscriptionId supports the '=' operator.
- ParentId supports the '=', '!=', 'IN', and 'NOT IN' operators.
- CustomerId supports the '=' operator.
- Status supports the '=' operator.
- Product supports the '=' operator.
The following examples demonstrate basic queries using supported filters:
-- Query by subscription ID
SELECT * FROM SubscriptionLineItems WHERE SubscriptionId = 4
-- Query by parent subscription
SELECT * FROM SubscriptionLineItems WHERE ParentId = 4
-- Query excluding a parent subscription
SELECT * FROM SubscriptionLineItems WHERE ParentId != 4
-- Query using a list of parent subscriptions
SELECT * FROM SubscriptionLineItems WHERE ParentId IN (4, 5)
-- Query excluding a list of parent subscriptions
SELECT * FROM SubscriptionLineItems WHERE ParentId NOT IN (4, 5)
-- Filter by subscription status and customer
SELECT * FROM SubscriptionLineItems WHERE Status = 'pending' AND CustomerId = 501
-- Filter by product
SELECT * FROM SubscriptionLineItems WHERE Product = 101
Columns
| Name | Type | References | Description |
| Id [KEY] | Integer | Item ID. | |
| SubscriptionId | Integer | Subscription ID. | |
| ImageId | String | Image ID. | |
| ImageSrc | String | Image Source. | |
| MetaData | String | Meta data. | |
| Name | String | Product name. | |
| ParentName | String | Parent product name if the product is a variation. | |
| Price | Integer | Product price. | |
| ProductId | Integer | Product ID. | |
| Quantity | Integer | Quantity ordered. | |
| Sku | String | Product SKU. | |
| Subtotal | String | Line subtotal (before discounts). | |
| SubtotalTax | String | Line subtotal tax (before discounts). | |
| TaxClass | String | Slug of the tax class of product. | |
| Taxes | String | Line taxes. | |
| Total | String | Line total (after discounts). | |
| TotalTax | String | Line total tax (after discounts). | |
| VariationId | Integer | Variation ID, if applicable. | |
| ParentId | Integer | Parent/initial order ID for the subscription. | |
| CustomerId | Integer |
Customers.Id | User ID who owns the subscription. |
| Status | String | Subscription status.
The default value is pending. |
Pseudo-Columns
Pseudo column fields are used in the WHERE clause of SELECT statements and offer a more granular control over the tuples that are returned from the data source.
| Name | Type | Description | |
| Product | String | Limit result set to subscriptions assigned a specific product ID. | |
| ReferenceNumber | String | This column will be used in Bulk operations to get specific values from the Temp tables. |