API Documentation
Interfaces, Classes and Traits
- Eeco_Gift_Cards_Update_Client
- Client for our API handling plugin updates and license validation.
- HookDocsGenerator
- Generate documentation for hooks in WC
- Eeco_Gift_Cards_My_Account
- Eeco_Gift_Card
- Eeco_Gift_Cards_Checkout
- Eeco_Gift_Cards_Main
- Eeco_Gift_Cards_Register_Content
- Eeco_Gift_Cards_Reports
- Eeco_Gift_Cards_Settings
- Eeco_Gift_Cards_Reports_Table
- Eeco_Offline_Gift_Card_Admin
- Class WC_Customer_Cancel_Order
- Eeco_Offline_Gift_Card_Customer
- Class WC_Customer_Cancel_Order
- Eeco_Online_Gift_Card_Admin
- Class WC_Customer_Cancel_Order
- Eeco_Online_Gift_Card_Customer
- Class WC_Customer_Cancel_Order
- WC_Product_Offline_Gift_Card
- extending wc_product class to add a new product type overriding all the necessary methods
- WC_Product_Online_Gift_Card
- extending wc_product class to add a new product type overriding all the necessary methods
Table of Contents
- EECO_GIFT_CARDS_DB_VERSION = '2'
- EECO_GIFT_CARDS_PATH = untrailingslashit(plugin_dir_path(__FILE__))
- EECO_GIFT_CARDS_ROOT = plugin_dir_path(__FILE__)
- EECO_GIFT_CARDS_VERSION = '1.3.4'
- activate_eeco_gift_cards() : mixed
- check for plugin dependencies and deactivate plugin if they don't exist
- deactivate_eeco_gift_cards() : mixed
- deactivate plugin
- init_eeco_gift_cards() : mixed
- init plugin functionalities
- resend_email() : mixed
- Resend the gift card to customer
- eeco_gift_cards_csv_import() : mixed
- Import gift cards via csv-file
- eeco_gift_cards_get_template() : mixed
- gets the given template and includes it
- create_gift_card_pdf() : string
- Function creates a gift card pdf file from order, giftcard and settings objects.
- eeco_gift_cards_render() : string
- Render gift card on settings page for preview
- eeco_gift_cards_download_preview_pdf() : mixed
- Download PDF of the example gift card
- eeco_gift_cards_render_template() : string
- Generate gift card html using handlebars
- get_eeco_gift_cards_for_order() : array<string|int, mixed>
- fetches the gift cards for given order can be filtered by gift card type
- eeco_get_gift_card_post() : WP_Post|bool
- get the post for single giftcard
- eeco_get_gift_card() : Eeco_Gift_Card|bool
- get a single gift card
- eeco_gift_cards_create_transaction() : bool
- add gift card transaction
- eeco_gif_cards_template_root() : string
- get gift cards tempalate root
- eeco_gift_cards_format_date() : mixed
- format the given date
- eeco_gift_cards_create_exipration_date() : string
- generates the end date for gift card validity
- eeco_gift_cards_download_file() : mixed
- Download and delete file from the server
- eeco_gift_cards_format_price() : string
- Format a price using woocommerce wp and woocommerce options
- eeco_gift_cards_attachments() : mixed
- Create attachments for the gift card email
- eeco_gift_cards_register_emails() : mixed
- Set email classes for gift cards
- eeco_gift_cards_query() : void
- alter gift cards query when querying by post id
- eeco_gift_cards_add_prefix() : string
- prefix the gift card code if it has been set
- eeco_gift_cards_toggle_status() : mixed
- toggle gift card active status
- eeco_gift_cards_deliver_gift_card() : mixed
- deliver the scheduled gift card
- eeco_gift_cards_email_actions() : array<string|int, mixed>
- add email actions
- eeco_gift_cards_check_for_expired() : mixed
- Check for expired gift cards and update their status
Constants
EECO_GIFT_CARDS_DB_VERSION
public
mixed
EECO_GIFT_CARDS_DB_VERSION
= '2'
EECO_GIFT_CARDS_PATH
public
mixed
EECO_GIFT_CARDS_PATH
= untrailingslashit(plugin_dir_path(__FILE__))
EECO_GIFT_CARDS_ROOT
public
mixed
EECO_GIFT_CARDS_ROOT
= plugin_dir_path(__FILE__)
EECO_GIFT_CARDS_VERSION
public
mixed
EECO_GIFT_CARDS_VERSION
= '1.3.4'
Functions
activate_eeco_gift_cards()
check for plugin dependencies and deactivate plugin if they don't exist
activate_eeco_gift_cards() : mixed
Return values
mixed —deactivate_eeco_gift_cards()
deactivate plugin
deactivate_eeco_gift_cards() : mixed
Return values
mixed —init_eeco_gift_cards()
init plugin functionalities
init_eeco_gift_cards() : mixed
Return values
mixed —resend_email()
Resend the gift card to customer
resend_email() : mixed
Return values
mixed —eeco_gift_cards_csv_import()
Import gift cards via csv-file
eeco_gift_cards_csv_import() : mixed
Return values
mixed —eeco_gift_cards_get_template()
gets the given template and includes it
eeco_gift_cards_get_template(mixed $template[, array<string|int, mixed> $args = array() ]) : mixed
Parameters
- $template : mixed
- $args : array<string|int, mixed> = array()
-
Arguments to pass to the template
Return values
mixed —create_gift_card_pdf()
Function creates a gift card pdf file from order, giftcard and settings objects.
create_gift_card_pdf(object $order, mixed $gift_card) : string
Gift card pdf files will be uploaded to wp upload directory /giftcard folder.
Parameters
- $order : object
-
Order data
- $gift_card : mixed
Tags
Return values
string —Where gift card pdf was created.
eeco_gift_cards_render()
Render gift card on settings page for preview
eeco_gift_cards_render(string $type) : string
Parameters
- $type : string
-
The git card type
Return values
string —eeco_gift_cards_download_preview_pdf()
Download PDF of the example gift card
eeco_gift_cards_download_preview_pdf(string $type) : mixed
Parameters
- $type : string
-
The gift card type
Return values
mixed —eeco_gift_cards_render_template()
Generate gift card html using handlebars
eeco_gift_cards_render_template(array<string|int, mixed> $card, mixed $type) : string
Parameters
- $card : array<string|int, mixed>
-
The card content
- $type : mixed
Return values
string —get_eeco_gift_cards_for_order()
fetches the gift cards for given order can be filtered by gift card type
get_eeco_gift_cards_for_order(int $order_id[, string|array<string|int, mixed> $types = array('offline_gift_card', 'online_gift_card') ]) : array<string|int, mixed>
Parameters
- $order_id : int
-
The order id
- $types : string|array<string|int, mixed> = array('offline_gift_card', 'online_gift_card')
-
Gift card types
Return values
array<string|int, mixed> —Queried posts
eeco_get_gift_card_post()
get the post for single giftcard
eeco_get_gift_card_post(string $code) : WP_Post|bool
Parameters
- $code : string
-
The code
Return values
WP_Post|bool —eeco_get_gift_card()
get a single gift card
eeco_get_gift_card(string $code) : Eeco_Gift_Card|bool
Parameters
- $code : string
-
The gift card code
Return values
Eeco_Gift_Card|bool —eeco_gift_cards_create_transaction()
add gift card transaction
eeco_gift_cards_create_transaction(int $order_id, int $gift_card_id, string $validator, float $amount, float $tax) : bool
Parameters
- $order_id : int
-
Id of the order
- $gift_card_id : int
-
Id of the gift card
- $validator : string
-
Validator value
- $amount : float
-
Amount used in the transaction
- $tax : float
-
Taxes
Return values
bool —eeco_gif_cards_template_root()
get gift cards tempalate root
eeco_gif_cards_template_root(string $template[, string $dir = 'partials' ]) : string
Parameters
- $template : string
-
The template
- $dir : string = 'partials'
-
The directory
Return values
string —Template root
eeco_gift_cards_format_date()
format the given date
eeco_gift_cards_format_date(string $date[, string $old = '.' ][, string $new = '-' ][, string $format = 'Y-m-d' ]) : mixed
Parameters
- $date : string
-
The date to format
- $old : string = '.'
-
The old date separator
- $new : string = '-'
-
The new date separator
- $format : string = 'Y-m-d'
-
The new format
Return values
mixed —eeco_gift_cards_create_exipration_date()
generates the end date for gift card validity
eeco_gift_cards_create_exipration_date(WC_Order_Item_Product $item, WC_Product $product) : string
Parameters
- $item : WC_Order_Item_Product
-
Order item
- $product : WC_Product
-
Product
Return values
string —expiration date
eeco_gift_cards_download_file()
Download and delete file from the server
eeco_gift_cards_download_file(string $url, string $path[, bool $delete = true ]) : mixed
Parameters
- $url : string
-
File url
- $path : string
-
File path
- $delete : bool = true
-
Delete file after download
Return values
mixed —eeco_gift_cards_format_price()
Format a price using woocommerce wp and woocommerce options
eeco_gift_cards_format_price(float $amount[, bool $currency = true ]) : string
Parameters
- $amount : float
-
The price to format
- $currency : bool = true
-
Whether to add currency symbol
Return values
string —Formatted price
eeco_gift_cards_attachments()
Create attachments for the gift card email
eeco_gift_cards_attachments(mixed $order_id) : mixed
Parameters
- $order_id : mixed
Return values
mixed —eeco_gift_cards_register_emails()
Set email classes for gift cards
eeco_gift_cards_register_emails(array<string|int, mixed> $emails) : mixed
Parameters
- $emails : array<string|int, mixed>
-
Array of email classes
Return values
mixed —eeco_gift_cards_query()
alter gift cards query when querying by post id
eeco_gift_cards_query(WP_Query $query) : void
Parameters
- $query : WP_Query
-
The query object
Return values
void —eeco_gift_cards_add_prefix()
prefix the gift card code if it has been set
eeco_gift_cards_add_prefix(mixed $code) : string
Parameters
- $code : mixed
-
The code to prefix
Return values
string —Gift card code
eeco_gift_cards_toggle_status()
toggle gift card active status
eeco_gift_cards_toggle_status() : mixed
Return values
mixed —eeco_gift_cards_deliver_gift_card()
deliver the scheduled gift card
eeco_gift_cards_deliver_gift_card(int $order_id, int $gift_card_id) : mixed
Parameters
- $order_id : int
-
The order id
- $gift_card_id : int
-
The gift card id
Return values
mixed —eeco_gift_cards_email_actions()
add email actions
eeco_gift_cards_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> —Email actions
eeco_gift_cards_check_for_expired()
Check for expired gift cards and update their status
eeco_gift_cards_check_for_expired() : mixed