DiscountCodes
Create, select, update, and delete information regarding discount codes.
Table-Specific Information
Select
The cmdlet uses the Shopify API to process search criteria that refer to the PriceRuleId and Id columns. The supported SQL operator is '='. The cmdlet processes other filters client-side within the cmdlet.For example, the following queries are processed server-side:
SELECT * FROM DiscountCodes WHERE PriceRuleId = '123'
SELECT * FROM DiscountCodes WHERE PriceRuleId = '123' AND Id = '456'
Insert
You must specify the PriceRuleId and Code to create a discount code.
INSERT INTO DiscountCodes (PriceRuleId, Code) VALUES ('290807676951', 'SUMMERSALE100OFF')
Update
You must specify the PriceRuleId and Id to update a discount code. For example:
UPDATE DiscountCodes SET Code = 'WINTERSALE500OFF' WHERE PriceRuleId = '123' AND Id = '456'
Delete
You must specify the Id of the custom collection to delete it.
DELETE FROM DiscountCodes WHERE PriceRuleId = '123' AND Id = '456'
Columns
Name | Type | ReadOnly | References | Description |
Id [KEY] | Long | True |
A unique numeric identifier for the discount code. | |
PriceRuleId [KEY] | Long | False |
PriceRules.Id |
The Id for the price rule that this discount code belongs to. |
Code | String | False |
The case-insensitive discount code that customers use at checkout. | |
UsageCount | Int | True |
The number of times that the discount code has been redeemed. | |
CreatedAt | Datetime | True |
The date and time when the discount code was created. | |
UpdatedAt | Datetime | True |
The date and time when the discount code was last modified. |