-
Notifications
You must be signed in to change notification settings - Fork 212
Open
Milestone
Description
When you generate a coupon from the code directly perhaps we should check for duplicates ?
<?php
$coup_creation = date( 'Y-m-d') . " 00:00:00";
$coup_expiration = date( 'Y-m-d', strtotime( '+1 month' ) ). " 23:59:59";
$new_coupon = new WPSC_Coupon( array(
'coupon_code' => 'd1e1d1d12d212d', // d1e1d1d12d212d
'value' => '20',
'is-percentage' => true, // true for %
'use-once' => true,
'is-used' => 0,
'active' => true,
'every_product' => false,
'start' => $coup_creation,
'expiry' => $coup_expiration,
'condition' => array()
) );
$insert = $new_coupon->save();
If you run the code you will get multiple coupons with the same name
Metadata
Metadata
Assignees
Labels
No labels