Coupons
Create,list,update or delete coupons.
Table Specific Information
Select
The cmdlet uses the BigCommerce API to process WHERE clause conditions built with the following columns and operators:
- Id supports the '=, >, <, >=, and <=' comparisons.
- Name supports the '=' comparison.
- Type supports the '= and !=' comparison.
- Code supports the '=' comparison.
The rest of the filter is executed client-side within the cmdlet.
For example, the following queries are processed server-side:
SELECT * FROM Coupons WHERE Id = 1 SELECT * FROM Coupons WHERE Id >= 1 AND Id <= 5 SELECT * FROM Coupons WHERE Name = "test"
Insert
To insert a new Coupon, you need to specify at least the following columns: Name, Type, Code, Amount, AppliesToEntity and AppliesToIds.
INSERT INTO Coupons (Name, Type, Code, Amount, AppliesToEntity, AppliesToIds) VALUES ('CouponName', 'free_shipping', 'CN100', 500, 'products', '88, 80')
Update
UPDATE Coupons SET Code = 'ABC' WHERE Id = 12
Delete
DELETE FROM Coupons WHERE Id = 16
Columns
Name | Type | ReadOnly | References | Description |
Id [KEY] | Integer | True |
The coupons ID. | |
Name | String | False |
The name of the coupon. | |
Type | String | False |
Type of the coupon. Must be one of per_item_discount,per_total_discount,shipping_discount,free_shipping or percentage_discount. The allowed values are per_item_discount, percentage_discount, per_total_discount, shipping_discount, free_shipping, promotion. | |
Amount | Decimal | False |
The discount to apply to an order, as either an amount or a percentage. | |
MinPurchase | Decimal | False |
Specifies a minimum value that an order must have before the coupon can be applied to it. | |
Expires | Datetime | False |
Specifies when a coupon expires. | |
Enabled | Boolean | False |
If the coupon is enabled, this fields value is true; otherwise, false. | |
Code | String | False |
The coupon code that customers uses to receive their discounts. | |
AppliesToEntity | String | False |
What the discount applies to. Can be products or categories. | |
AppliesToIds | String | False |
IDs of either the products or categories | |
NumUses | Integer | True |
Number of times this coupon has been used. | |
MaxUses | Integer | False |
Maximum number of times this coupon can be used. | |
MaxUsesPerCustomer | Integer | False |
Maximum number of times each customer can use this coupon. | |
DateCreated | Datetime | False |
Date Created | |
ShippingMethods | String | False |
List of shipping-method names. | |
RestrictedToCountries | String | False |
Countries where the coupon is restricted. |