Skip to content

Instantly share code, notes, and snippets.

@filipecsweb
Last active May 29, 2019 10:30
Show Gist options
  • Save filipecsweb/8c0773c35391540fdf1f to your computer and use it in GitHub Desktop.
Save filipecsweb/8c0773c35391540fdf1f to your computer and use it in GitHub Desktop.
Overwrite subject line of the WooCommerce transactional e-mails
<?php
/**
* Sobrescrever assunto dos emails transacionais do WooCommerce.
*
* Tags possíveis para usar como parâmetro em add_filter():
*
* woocommerce_email_subject_new_order = Novo pedido
* woocommerce_email_subject_customer_processing_order = Processando pedido
* woocommerce_email_subject_customer_completed_order = Pedido concluído
* woocommerce_email_subject_customer_invoice = Fatura do cliente
* woocommerce_email_subject_customer_note = Nota do cliente
* woocommerce_email_subject_low_stock = Notificações de baixo estoque
* woocommerce_email_subject_no_stock = Notificações de item em falta no estoque
* woocommerce_email_subject_backorder = Pedido de produto sob encomenda
* woocommerce_email_subject_customer_new_account = Nova conta
* woocommerce_email_subject_correios_tracking = Template criado pelo plugin WooCommerce Correios
*
* @return string $subject Nova linha de assunto.
*/
function change_transactional_email_subject( $subject, $order ) {
$subject = sprintf( ' %s, recebemos seu pedido #%s em %s', $order->billing_first_name, $order->id, date_i18n( wc_date_format(), strtotime( $order->order_date ) ) );
return $subject;
}
add_filter( 'woocommerce_email_subject_new_order', 'change_transactional_email_subject', 100, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment