API Documentation
Interfaces, Classes and Traits
- Eeco_WCO_Update_Client
- Client for our API handling plugin updates and license validation.
- Eeco_WCO_Account
- Eeco_WCO_Admin
- Eeco_WCO_Ajax
- Eeco_WCO_cart
- Eeco_WCO_DB
- Eeco_WCO_Main
- Eeco_WCO_Offer_Table
- Eeco_Cart_Offers_Reports
- Eeco_WCO_Offer_Accepted_Email
- Class Eeco_WCO_New_Offer_Email
- Eeco_WCO_Offer_Declined_Email
- Class Eeco_WCO_New_Offer_Email
- Eeco_WCO_Offer_Edit_Email
- Class eeco_wco_offer_edit_email
- Eeco_WCO_Offer_Expiring_Email
- Class Eeco_WCO_New_Offer_Email
- Eeco_WCO_New_Offer_Email
- Class Eeco_WCO_New_Offer_Email
Table of Contents
- EECO_WCO_DB_VERSION = '1.7'
- EECO_WCO_PATH = untrailingslashit(plugin_dir_path(__FILE__))
- EECO_WCO_ROOT = plugin_dir_path(__FILE__)
- EECO_WCO_URL = plugin_dir_url(__FILE__)
- EECO_WCO_VERSION = '1.0.3'
- init_eeco_wco() : mixed
- initialize plugin
- activate_eeco_wco() : mixed
- activate plugin
- deactivate_eeco_wco() : mixed
- deactivate plugin
- eeco_wco_default_settings() : array<string|int, mixed>
- the default settings used on the settings page
- eeco_wco_get_template() : mixed
- returns the given template contents
- eeco_wco_is_user_logged_in() : bool
- returns if user logged in
- wco_create_offer() : int
- create offer to database
- wco_get_offers() : array<string|int, mixed>
- returns all user offers
- wco_get_offer() : object
- returns an offer
- wco_edit_offer() : bool
- edit an offer in database
- wco_add_product() : int
- Add products
- wco_get_products() : array<string|int, mixed>
- Get offer products by post id
- wco_get_offer_products() : array<string|int, mixed>
- Get all offer products
- wco_coupon_to_offer() : bool
- Add coupon to offer
- wco_get_coupon_products() : array<string|int, mixed>
- Get all products for a coupon
- wco_set_coupon_inactive() : bool
- Set used coupon inactive after checkout
- wco_get_offer_by_coupon() : object
- Get offer by coupon code
- wco_update_offer_coupon() : bool
- Update offer coupon
- wco_decline_offer() : bool
- Set offer as top manager declined
- get_pending_offer_count() : array<string|int, mixed>
- Get all pending offers
- get_active_offer_count() : array<string|int, mixed>
- Get all active offers
- wco_customer_decline_offer() : bool
- Set offer as customer declined
- wco_cancel_offer() : bool
- Set offer as customer cancelled
- wco_disable_add_to_cart() : bool
- Disable add to cart if wco coupon active in cart
- wco_remove_add_to_cart() : mixed
- Remove add to cart button when cart offer coupon active for user
- eeco_wco_register_emails() : array<string|int, mixed>
- Register emails classes
- eeco_wco_email_actions() : array<string|int, mixed>
- add email actions
- eeco_wco_get_email_table_template() : string
- Generate the product table used in emails
- eeco_wco_scheduled_event() : mixed
- Register scheduled event that triggers function eeco_wco_expiring_offer daily
- eeco_wco_expiring_offer() : mixed
- Check daily if offer is going to expire
- get_offer_values() : int
- get_offer_discount() : string
- Get discounted price for quote
- get_offer_discount_value() : int
- Get discount value for quote
- get_admin_dates_offer_values() : mixed
Constants
EECO_WCO_DB_VERSION
public
mixed
EECO_WCO_DB_VERSION
= '1.7'
EECO_WCO_PATH
public
mixed
EECO_WCO_PATH
= untrailingslashit(plugin_dir_path(__FILE__))
EECO_WCO_ROOT
public
mixed
EECO_WCO_ROOT
= plugin_dir_path(__FILE__)
EECO_WCO_URL
public
mixed
EECO_WCO_URL
= plugin_dir_url(__FILE__)
EECO_WCO_VERSION
public
mixed
EECO_WCO_VERSION
= '1.0.3'
Functions
init_eeco_wco()
initialize plugin
init_eeco_wco() : mixed
Return values
mixed —activate_eeco_wco()
activate plugin
activate_eeco_wco() : mixed
Return values
mixed —deactivate_eeco_wco()
deactivate plugin
deactivate_eeco_wco() : mixed
Return values
mixed —eeco_wco_default_settings()
the default settings used on the settings page
eeco_wco_default_settings([bool $keys = false ]) : array<string|int, mixed>
Parameters
- $keys : bool = false
-
Whether to only return setting keys
Return values
array<string|int, mixed> —Default settings of WCO
eeco_wco_get_template()
returns the given template contents
eeco_wco_get_template(string $template[, mixed $args = array() ]) : mixed
Parameters
- $template : string
-
The template name
- $args : mixed = array()
Return values
mixed —eeco_wco_is_user_logged_in()
returns if user logged in
eeco_wco_is_user_logged_in() : bool
Return values
bool —true if user logged in, false if not
wco_create_offer()
create offer to database
wco_create_offer(int $post_id, int $user_id, string $type, string $taxes, float $value, string $status, string $expiry_date) : int
Parameters
- $post_id : int
-
id of a post
- $user_id : int
-
id of a user
- $type : string
-
of an offer
- $taxes : string
-
coupon taxes to taxable or tax free price
- $value : float
-
float of offer value
- $status : string
-
status of an offer
- $expiry_date : string
-
expiry date of an offer
Return values
int —$result id of offer created
wco_get_offers()
returns all user offers
wco_get_offers([int $user_id = null ][, string|array<string|int, mixed> $status = 'all' ]) : array<string|int, mixed>
Parameters
- $user_id : int = null
-
id of user
- $status : string|array<string|int, mixed> = 'all'
-
Offer status or statuses
Return values
array<string|int, mixed> —of offers for user
wco_get_offer()
returns an offer
wco_get_offer(int $post_id) : object
Parameters
- $post_id : int
-
of offer id
Return values
object —offer
wco_edit_offer()
edit an offer in database
wco_edit_offer(int $post_id, string $type, string $taxes, float $value, string $status, string $expiry_date) : bool
Parameters
- $post_id : int
-
id of a post
- $type : string
-
of an offer
- $taxes : string
-
coupon taxes to taxable or tax free price
- $value : float
-
float of offer value
- $status : string
-
status of an offer
- $expiry_date : string
-
expiry date of an offer
Return values
bool —true || false if offer updated
wco_add_product()
Add products
wco_add_product(int $post_id, int $product_id, int $quantity, float $total, float $tax) : int
Parameters
- $post_id : int
-
of an offer
- $product_id : int
-
of product to add
- $quantity : int
-
quantity of product to add
- $total : float
-
line total of cart item
- $tax : float
-
tax total of cart item
Return values
int —true|false if successfully added
wco_get_products()
Get offer products by post id
wco_get_products(int $post_id) : array<string|int, mixed>
Parameters
- $post_id : int
-
if of an offer
Return values
array<string|int, mixed> —products for an offer
wco_get_offer_products()
Get all offer products
wco_get_offer_products( $offerID) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —all products for an offer
wco_coupon_to_offer()
Add coupon to offer
wco_coupon_to_offer(int $post_id, string $coupon_name) : bool
Parameters
- $post_id : int
-
id of an offer
- $coupon_name : string
-
name of a coupon
Return values
bool —true || false if coupon added to offer successfully
wco_get_coupon_products()
Get all products for a coupon
wco_get_coupon_products(int $coupon) : array<string|int, mixed>
Parameters
- $coupon : int
-
id of a coupon
Return values
array<string|int, mixed> —products for a coupon
wco_set_coupon_inactive()
Set used coupon inactive after checkout
wco_set_coupon_inactive(int $coupon, int $order_id) : bool
Parameters
- $coupon : int
-
id of a coupon
- $order_id : int
-
id of a order where coupon is used
Return values
bool —true || false if updated
wco_get_offer_by_coupon()
Get offer by coupon code
wco_get_offer_by_coupon(int $coupon) : object
Parameters
- $coupon : int
-
id of a coupon
Return values
object —offer
wco_update_offer_coupon()
Update offer coupon
wco_update_offer_coupon(int $post_id, int $coupon) : bool
Parameters
- $post_id : int
-
id of an offer
- $coupon : int
-
id of a coupon
Return values
bool —true || false if updated rows
wco_decline_offer()
Set offer as top manager declined
wco_decline_offer(int $post_id) : bool
Parameters
- $post_id : int
-
id of an offer
Return values
bool —true || false if offer updated
get_pending_offer_count()
Get all pending offers
get_pending_offer_count() : array<string|int, mixed>
Return values
array<string|int, mixed> —all pending offers
get_active_offer_count()
Get all active offers
get_active_offer_count(int $userID) : array<string|int, mixed>
Parameters
- $userID : int
-
id of user
Return values
array<string|int, mixed> —all active offers
wco_customer_decline_offer()
Set offer as customer declined
wco_customer_decline_offer(int $post_id) : bool
Parameters
- $post_id : int
-
of offer edited
Return values
bool —true || false if offer edited
wco_cancel_offer()
Set offer as customer cancelled
wco_cancel_offer(int $post_id) : bool
Parameters
- $post_id : int
-
of offer cancelled
Return values
bool —true || false if offer cancelled
wco_disable_add_to_cart()
Disable add to cart if wco coupon active in cart
wco_disable_add_to_cart(mixed $passed, mixed $product_id, mixed $quantity) : bool
Parameters
- $passed : mixed
- $product_id : mixed
- $quantity : mixed
Return values
bool —true || false if disabled or not
wco_remove_add_to_cart()
Remove add to cart button when cart offer coupon active for user
wco_remove_add_to_cart() : mixed
Return values
mixed —eeco_wco_register_emails()
Register emails classes
eeco_wco_register_emails(array<string|int, mixed> $emails) : array<string|int, mixed>
Parameters
- $emails : array<string|int, mixed>
-
array of email classes
Return values
array<string|int, mixed> —Array of email classes
eeco_wco_email_actions()
add email actions
eeco_wco_email_actions(array<string|int, mixed> $actions) : array<string|int, mixed>
Parameters
- $actions : array<string|int, mixed>
-
The current actions
Return values
array<string|int, mixed> —Array of email actions
eeco_wco_get_email_table_template()
Generate the product table used in emails
eeco_wco_get_email_table_template(mixed $offer[, mixed $type = 'product' ]) : string
Parameters
- $offer : mixed
- $type : mixed = 'product'
Return values
string —Table html
eeco_wco_scheduled_event()
Register scheduled event that triggers function eeco_wco_expiring_offer daily
eeco_wco_scheduled_event() : mixed
Return values
mixed —eeco_wco_expiring_offer()
Check daily if offer is going to expire
eeco_wco_expiring_offer() : mixed
Return values
mixed —get_offer_values()
get_offer_values(array<string|int, mixed> $status[, datetime $start = '1970-01-01 00:00:00' ][, datetime $end = '2500-01-01 23:59:59' ]) : int
Parameters
- $status : array<string|int, mixed>
-
Array of offer statuses
- $start : datetime = '1970-01-01 00:00:00'
-
Start date Y-m-d H:i:s
- $end : datetime = '2500-01-01 23:59:59'
-
End date Y-m-d H:i:s
Return values
int —Total value of given offers
get_offer_discount()
Get discounted price for quote
get_offer_discount(object $offer) : string
Parameters
- $offer : object
-
Offer
Return values
string —Discounted price of the quote wc_price()
get_offer_discount_value()
Get discount value for quote
get_offer_discount_value(object $offer) : int
Parameters
- $offer : object
-
Offer
Return values
int —Discount value
get_admin_dates_offer_values()
get_admin_dates_offer_values(mixed $status[, mixed $start = '1970-01-01' ][, mixed $end = '2500-01-01' ]) : mixed
Parameters
- $status : mixed
- $start : mixed = '1970-01-01'
- $end : mixed = '2500-01-01'