Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Users can sign up for Maileon newsletters by checking the checkbox on various 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

...

$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:

...

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.

...

Code Block
languagephp
$wc_email_hooks = [
            \WC_Email_Customer_Completed_Order::class => [
            'actions' => [
                'woocommerce_order_status_completed_notification' => ['WC_Email_Customer_Completed_Order()', 'trigger', 10, 2]
            ],
            'class' => Maileon\WooCommerce\Emails\class => CompletedOrder::class,
        ],
            \WC_Email_Customer_On_Hold_Order::class => [
            'actions' => [
                'woocommerce_order_status_pending_to_on-hold_notification' => ['WC_Email_Customer_On_Hold_Order()', 'trigger', 10, 2],
                'woocommerce_order_status_failed_to_on-hold_notification' => ['WC_Email_Customer_On_Hold_Order()', 'trigger', 10, 2],
                'woocommerce_order_status_cancelled_to_on-hold_notification' => ['WC_Email_Customer_On_Hold_Order()', 'trigger', 10, 2]
            ],
            'class' => Maileon\WooCommerce\Emails\class => OnHoldOrder::class,
          ],          \WC_Email_Customer_Processing_Order::class => [
            'actions' => [
                'woocommerce_order_status_cancelled_to_processing_notification' => ['WC_Email_Customer_Processing_Order()', 'trigger', 10, 2],
                'woocommerce_order_status_failed_to_processing_notification' => ['WC_Email_Customer_Processing_Order()', 'trigger', 10, 2],
                'woocommerce_order_status_on-hold_to_processing_notification' => ['WC_Email_Customer_Processing_Order()', 'trigger', 10, 2],
                'woocommerce_order_status_pending_to_processing_notification' => ['WC_Email_Customer_Processing_Order()', 'trigger', 10, 2],
            ],
            'class' => Maileon\WooCommerce\Emails\class => ProcessingOrder::class,
         ],           \WC_Email_Customer_Refunded_Order::class => [
            'actions' => [
                'woocommerce_order_fully_refunded_notification' => ['WC_Email_Customer_Refunded_Order()', 'trigger_full', 10, 2],
                'woocommerce_order_partially_refunded_notification' => ['WC_Email_Customer_Refunded_Order()', 'trigger_partial', 10, 2]
            ],
            'class' => Maileon\WooCommerce\Emails\RefundedOrder::class,
        ]
    ]

...

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.

...

wc_maileon_transaction_archiving_duration

Description

wc_maileon_transaction_archiving_duration is a filter applied to all Maileon transaction archiving durations.

...

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_maileon_transaction_attributes

Description

wc_maileon_transaction_attributes is a filter applied to all Maileon 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_maileon_transaction_map_order_products

Description

wc_maileon_transaction_map_order_products is applied to product lines.

...

wc_maileon_transaction_map_order_product_item

Description

wc_maileon_transaction_map_order_product_item is applied to a single product line item.

...

wc_maileon_transaction_map_order_fees

Description

wc_maileon_transaction_map_order_fees is applied to fees and shipping lines.

...

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.

...

wc_maileon_transaction_map_order_fee_item

Description

wc_maileon_transaction_map_order_fee_item is applied to a single fee line item.

...

wc_maileon_transaction_map_order_discounts

Description

wc_maileon_transaction_map_order_discounts is applied to coupon lines.

...

wc_maileon_transaction_map_order_discount_item

Description

wc_maileon_transaction_map_order_discount_item is applied to a single coupon line item.

...

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

Description

wc_maileon_webhook_related_products_map_product_{$type}is a filter applied to each product in related products JSON endpoint. $typeis one of the following:

  • upsell

  • cross_sell

Parameters

$data
(array) The mapped product array

$product
(\WC_Product) The original WooCommerce product

Description

wc_maileon_webhook_related_productsis 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