Project 1
$coupon_code = 'save10percent'; global $woocommerce; $c = new WC_Coupon($coupon_code);
echo "Discount Amount ".$c->amount."<br>";//Get Discount amount echo "Discount Type ".$c->discount_type."<br>";//Get type of discount echo "Individual Use ".$c->individual_use."<br>";//Get individual use status echo "Usage Count ".$c->usage_count."<br>";//Get number of times the coupon has been used echo "Uage Limit ".$c->usage_limit."<br>";//Get usage limit echo "Coupon Description ".$c->description."<br>";//Get coupon description
code
CREATE TABLE `shopping_cart`.`product` (
`id` INT(10) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(100) NOT NULL,
`desc` TEXT NOT NULL,
`SKU` VARCHAR(50) NOT NULL,
`category` VARCHAR(50) NOT NULL,
`price` DECIMAL(6) NOT NULL,
`discount_id` INT(5) DEFAULT '0',
`created_at` TIMESTAMP NOT NULL,
`modified_at` TIMESTAMP,
UNIQUE KEY `prod_index` (`id`) USING BTREE,
UNIQUE KEY `sku_index` (`id`,`SKU`) USING BTREE,
PRIMARY KEY (`id`),
CONSTRAINT `fk_prod_discount`
FOREIGN KEY (`discount_id`)
REFERENCES `shopping_cart`.`discount` (`id`)
ON DELETE SET NULL
ON UPDATE SET NULL
) ENGINE=InnoDB;
CREATE TABLE `shopping_cart`.`shopping_session` (
`id` INT(30) NOT NULL AUTO_INCREMENT,
`user_id` INT(10) DEFAULT NULL,
`total` DECIMAL(10) NOT NULL DEFAULT '0.00',
`created_at` TIMESTAMP NOT NULL,
`modified_at` TIMESTAMP,
UNIQUE KEY `session_index` (`id`,`user_id`) USING BTREE,
PRIMARY KEY (`id`),
CONSTRAINT `fk_shopping_user`
FOREIGN KEY (`user_id`)
REFERENCES `shopping_cart`.`user` (`id`)
ON DELETE SET NULL
ON UPDATE SET NULL
) ENGINE=InnoDB;
CREATE TABLE `order_details` (
`id` INT(20) NOT NULL AUTO_INCREMENT,
`user_id` INT(10),
`total` DECIMAL(10) NOT NULL,
`payment_id` INT(20) NOT NULL,
`created_at` TIMESTAMP NOT NULL,
`modified_at` TIMESTAMP,
UNIQUE KEY `order_index` (`id`) USING BTREE,
UNIQUE KEY `customer_order_index` (`id`,`user_id`) USING BTREE,
PRIMARY KEY (`id`),
CONSTRAINT `fk_shopping_user_order`
FOREIGN KEY (`user_id`)
REFERENCES `shopping_cart`.`user` (`id`)
ON DELETE SET NULL
ON UPDATE SET NULL,
CONSTRAINT `fk_order_payment`
{
"cartId": 604638499041,
"userAuthToken": "6^t@CDm6DY7FZZq3E!0lT3rxb02d7&",
"registeredUser": true,
"items": [
{
"itemId": "1000000122",
"quantity": 2,
"group": [
"5e31a1f9fcc2b500089c10e8"
],
"price": {
"sale": 0,
"base": 120,
"discount": {
"price": 0
},
"currency": "USD"
},
"extra": {}
}
]
}
{
"cartId": 604638499041,
"userAuthToken": null,
"registeredUser": false,
"items": [
{
"itemId": "1000000015",
"quantity": 5,
"group": [
"LPCUsIdKqZhjHoA1Ok3tMCsc"
],
"price": {
"sale": 10,
"base": 50,
"discount": {
"price": 0
},
"currency": "USD"
},
"extra": {}
},
{
"itemId": "1002200074",
"quantity": 1,
"group": [
"3NXSiwNoKbQxe5pbM9hc10lb"
],
"price": {
"sale": 0,
"base": 450,
"discount": {
"price": 0
},
"currency": "USD"
},
"extra": {}
}
]
}