Filtros
| Filtro | Recebe | Uso |
|---|---|---|
wc_boleto_reminder_available_hours |
$hours |
Horários [ horas => descrição ]. |
wc_boleto_reminder_get_payment_data |
$args, $order |
Link e nome do método. Veja Adicionar método de pagamento. |
wc_boleto_reminder_valid_order_statuses_for_reminder |
['pending', 'on-hold'] |
Status que recebem lembrete (sem o wc-). |
wc_boleto_reminder_placeholders |
[], $order |
Variáveis extras [ '{chave}' => valor ]. |
wc_boleto_reminder_email_message |
$content, $order, $hours, $button_url, $method_name |
Conteúdo do e-mail, já com as variáveis trocadas. |
wc_boleto_reminder_render_email_message |
$message, $order, $email |
Conteúdo na hora de montar o template. |
wc_boleto_reminder_payment_button |
$html, $order, $button_url, $method_name |
HTML do botão. |
wc_boleto_reminder_css |
$css |
CSS do e-mail. |
woocommerce_email_subject_wc_boleto_reminder |
$subject, $order, $email |
Assunto (filtro do WooCommerce). |
Actions
| Action | Quando |
|---|---|
wc_payment_reminder_after_{$hours}_hours |
Na hora de cada lembrete. Recebe $order_id, $hours. |
O lembrete é criado em woocommerce_thankyou (prioridade 10) e os próximos são cancelados em woocommerce_order_status_processing, _completed e _cancelled.
Exemplos
Lembrete 2 horas depois do pedido, além dos configurados:
add_filter( 'wc_boleto_reminder_available_hours', function ( $hours ) {
return array( 2 => '2 horas depois' ) + $hours;
} );
Variável {total}:
add_filter( 'wc_boleto_reminder_placeholders', function ( $placeholders, $order ) {
$placeholders['{total}'] = wp_strip_all_tags( $order->get_formatted_order_total() );
return $placeholders;
}, 10, 2 );
SMS junto com o lembrete de 48 horas:
add_action( 'wc_payment_reminder_after_48_hours', function ( $order_id ) {
$order = wc_get_order( $order_id );
if ( $order && $order->has_status( array( 'pending', 'on-hold' ) ) ) {
meu_envio_de_sms( $order->get_billing_phone(), 'Seu boleto vence em breve.' );
}
}, 20 );