eeco_logo_svg Created with Sketch.

WooCommerce Gift Cards

functions.php

Table of Contents

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

Functions

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
see
https://mpdf.github.io/configuration/configuration-v7-x.html
see
https://mpdf.github.io/fonts-languages/fonts-in-mpdf-7-x.html
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_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

Search results