WC_Email_Customer_Abandoned_Cart_Recovery::get_unsubscribe_url
Get the unsubscribe URL for the currently-bound order's recipient.
Returns an HMAC-signed URL routed through Endpoint::QUERY_VAR (?wc-email-unsubscribe=…) and handled by UnsubscribesEndpoint. Empty when no order is bound or the order has no billing email — both states mean there's no recipient to unsubscribe and the template should suppress the footer link.
Method of the class: WC_Email_Customer_Abandoned_Cart_Recovery{}
No Hooks.
Returns
String.
Usage
$WC_Email_Customer_Abandoned_Cart_Recovery = new WC_Email_Customer_Abandoned_Cart_Recovery(); $WC_Email_Customer_Abandoned_Cart_Recovery->get_unsubscribe_url();
Changelog
| Since 11.0.0 | Introduced. |
WC_Email_Customer_Abandoned_Cart_Recovery::get_unsubscribe_url() WC Email Customer Abandoned Cart Recovery::get unsubscribe url code WC 11.0.0
public function get_unsubscribe_url() {
if ( ! $this->object instanceof WC_Order ) {
return '';
}
$email = $this->object->get_billing_email();
if ( '' === $email ) {
return '';
}
return UnsubscribesEndpoint::url_for( $this->object->get_id(), $email, $this->id );
}