As of BuycraftX 10.2, you can now create coupons in-game. As we wanted to create a solution which is easy to use in-game, there are some options which are not possible to achieve from the coupon creation command. If you need to, you can always modify the coupon from your control panel.
- Your coupon code will be automatically generated and can not be overridden.
- You can not restrict the coupon to certain items or categories.
- All coupons will apply to all items in a user's basket.
- All coupons will apply to both single purchase and subscriptions.
The coupon create command
When creating a coupon you will be able to use the "/buycraft coupon create ..." command.
This command takes a series of arguments are name and value pairs. With the exception of needing either value or percentage, all arguments are optional:
value - this coupon gives a fixed discount. The value of this argument is the amount to discount in the currency of your webstore. You may only provide one of either value or percentage.
percentage - this coupon gives a percentage discount. The value of this argument is the percentage to discount by. You may only provide one of either value or percentage.
expires - provide a string representing the duration for which this coupon is valid. 'expires' is a duration in the format of "nwndnhnd" some examples are "12d", "1h", "6d23h", and "1w3d1h42m". If not provided, this defaults to not having an expiry date. Unlike with old versions of coupons, both expiry and limit can be set at the same time.
limit - provides a numeric limit on the number of times this coupon can be used. If not provided, this defaults to a coupon being available for use unlimited times. Unlike with old versions of coupons, both expiry and limit can be set at the same time.
min_value - provides a numeric amount representing the minimum value of the basket in order for this coupon to be used. If not provided, then the coupon can be used on baskets of any value.
user_limit - provides a numeric limit on the number of times a specific user can use this coupon. If not provided, this defaults to the coupon being available for use an unlimited number of times by any user.
discount_application_method - provides a control for which coupon application method to use. 0 = Apply to each package (default), 1 = Apply to basket (before sales), 2 = Apply to basket (after sales). If not provided, this defaults to 0.
username - this options will allow you to assign a coupon to a specific user and is only available in the plugin versions 10.6.0+.
Full command examples:
The example below creates a coupon which discounts 25% expires in 12 days and it is assigned to only the player Notch can only redeem it, for a maximum number of 2 times.
/buycraft coupon create percentage 25 expires 12d user_limit 2 discount_application_method 2 username Notch
/buycraft coupon create value 10.10 limit 100 min_value 5 user_limit 1 discount_application_method 1
The coupon list command
The coupon list command will list out the coupons and their names in the console so that you can view them to give to your players.
/buycraft coupon list
The coupon delete command
You can also delete coupons from in-game using the following command.
/buycraft coupon delete <couponname>