Users can sign up for Maileon newsletters by checking the checkbox on the checkout pagevarious WooCommerce pages. Users who haven’t checked this checkbox will also be created in Maileon, however they will not have any permissions. This is due to the fact that the user needs to exist in order for Maileon to send transactional emails.
Templates
The plugin offers a way to customize the various template parts that are shown to the user. All the available templates are located in plugins/woocommerce-maileon/templates
. To override them you can copy the contents of this folder to your theme/woocommerce-maileon/
. The attributes passed to each template can be filtered using wc_maileon_{$hook}_attributes
and a wc_maileon_before_{$hook}
action is run before each rendered template part, and a wc_maileon_after_{$hook}
action is run after each. The hooks also get all the attributes passed to the template part being rendered.
The current list of hookable template parts:
account-newsletter
checkout-field
register-field
Contact Creation Filters
wc_maileon_contact_update_checkout
...
$data
(array
) The checkout data
$newsletter
(boolean
) Whether the user opted in to recieve newsletters
$doi
(boolean
) Whether the DOI process is enabled
...
$newsletter
(boolean
) Whether the user opted in to recieve newsletters
$doi
(boolean
) Whether the DOI process is enabled
wc_maileon_contact_update_account
...
$key
(string
) The DOI mailing key
wc_maileon_contact_meta_value
Description
wc_maileon_contact_meta_value
is a filter applied to each meta value to be synchronized to the Maileon contact.
$value
(mixed
) The value to be set in Maileon
$meta_value
(mixed
) The original meta value
$meta_key
(string
) The original meta key
$value_type
(string
) The type name of the Maileon contact property to be updated
$maileon
(array
) An array describing the Maileon contact property
wc_maileon_contact_meta_values
Description
wc_maileon_contact_meta_values
is a filter applied to the array of meta values to be synchronized to the Maileon contact.
$values
(mixed
) The values to be set in Maileon
Transaction Actions
wc_maileon_transaction_after_{$transaction_name}
Description
wc_maileon_transaction_after_{$transaction_name}
is an action running after every Maileon transaction. $transaction_name
is one of the following by default:
...
$result
(boolean
) Whether the transaction was successful
Email hooks
wc_maileon_email_hooks
Description
wc_maileon_email_hooks
is a filter applied to replaced WooCommerce emails. It can be used to override custom email types.
Parameters
$wc_email_hooks
(array
) The defined email hooks.
$wc_email_hooks
is an array of email classes for the plugin to override. The default definition is the following:
Code Block | ||
---|---|---|
| ||
$wc_email_hooks = [
\WC_Email_Customer_Completed_Order::class => CompletedOrder::class,
\WC_Email_Customer_On_Hold_Order::class => OnHoldOrder::class,
\WC_Email_Customer_Processing_Order::class => ProcessingOrder::class,
\WC_Email_Customer_Refunded_Order::class => RefundedOrder::class,
]; |
Since 1.2.8 wc_maileon_email_hooks
now accepts array values. If an array is provided the first element is the replacement class name, the second is the constructor parameters.
See [1.2.x] Sample Extension for examples.
Transaction Filters
wc_maileon_transaction_name
Description
wc_maileon_transaction_name
is a filter applied to all Maileon transaction names.
Parameters
$transaction_name
(string
) The transaction name
wc_maileon_transaction_archiving_duration
Description
wc_maileon_transaction_archiving_duration
is a filter applied to all Maileon transaction archiving durations.
Parameters
$duration
(integer
) The transaction archiving duration in days. Defaults to 365
wc_maileon_transaction_{$transaction_name}_archiving_duration
Description
wc_maileon_transaction_archiving_duration
is a filter applied to all Maileon transaction archiving durations. It can be used to modify the transaction archiving duration for transaction types created by the plugin. $transaction_name
is one of the following by default:
wc_completed_order
wc_on_hold_order
wc_processing_order
wc_refunded_order
Parameters
$duration
(integer
) The transaction archiving duration in days. Defaults to 365
wc_maileon_transaction_attributes
Description
wc_maileon_transaction_attributes
is a filter applied to all Maileon transaction attributes.
Parameters
$transaction_attributes
(Maileon\Transactions\AttributeType[]
) The transaction attributes
wc_maileon_transaction_{$transaction_name}_attributes
Description
wc_maileon_transaction_{$transaction_name}_attributes
is a filter applied to all Maileon transaction attribute definitions. It can be used to modify the transaction types created by the plugin. $transaction_name
is one of the following by default:
wc_completed_order
wc_on_hold_order
wc_processing_order
wc_refunded_order
Parameters
$transaction_attributes
(Maileon\Transactions\AttributeType[]
) The transaction type attributes
wc_maileon_transaction_map_order_products
Description
wc_maileon_transaction_map_order_products
is applied to product lines.
Parameters
$content
(array
) The mapped attributes
...
wc_maileon_transaction_map_order_product_item
Description
wc_maileon_transaction_map_order_product_item
is applied to a single product line item.
Parameters
$content
(array
) The mapped attributes
...
wc_maileon_transaction_map_order_fees
Description
wc_maileon_transaction_map_order_fees
is applied to fees and shipping lines.
Parameters
$content
(array
) The mapped attributes
...
wc_maileon_transaction_map_order_fee_shipping_item
Description
wc_maileon_transaction_map_order_fee_shipping_item
is applied to a single shipping line item.
Parameters
$content
(array
) The mapped attributes
...
wc_maileon_transaction_map_order_fee_item
Description
wc_maileon_transaction_map_order_fee_item
is applied to a single fee line item.
Parameters
$content
(array
) The mapped attributes
...
wc_maileon_transaction_map_order_discounts
Description
wc_maileon_transaction_map_order_discounts
is applied to coupon lines.
Parameters
$content
(array
) The mapped attributes
...
wc_maileon_transaction_map_order_discount_item
Description
wc_maileon_transaction_map_order_discount_item
is applied to a single coupon line item.
Parameters
$content
(array
) The mapped attributes
...
wc_maileon_transaction_{$transaction_name}_content
Description
wc_maileon_transaction_{$transaction_name}_content
is a filter applied to every Maileon transaction’s content. $transaction_name
is one of the following by default:
...
$email_id
(string
) The WooCommerce email id
Webhook Filters
wc_maileon_webhook_related_products_map_product_{$type}
Description
wc_maileon_webhook_related_products_map_product_{$type}
is a filter applied to each product in related products JSON endpoint. $type
is one of the following:
upsell
cross_sell
Parameters
$data
(array
) The mapped product array
$product
(\WC_Product
) The original WooCommerce product
wc_maileon_webhook_related_products
Description
wc_maileon_webhook_related_products
is a filter applied to the output of the related products JSON endpoint.
Parameters
$data
(array
) The mapped data
$product
(\WC_Product
) The WooCommerce product we are mapping related products for
$upsells
(\WC_Product[]
) The upsell WooCommerce products
$cross_sells
(\WC_Product[]
) The cross-sell WooCommerce products