LLMS_Notification_View_Purchase_Receipt::set_merge_data( string $code )
Replace merge codes with actual values
Parameters Parameters
- $code
-
(string) (Required) The merge code to get merged data for.
Return Return
(string)
Source Source
File: includes/notifications/views/class.llms.notification.view.purchase.receipt.php
protected function set_merge_data( $code ) { $transaction = $this->post; $order = $transaction->get_order(); switch ( $code ) { case '{{CUSTOMER_ADDRESS}}': $code = $order->get_customer_full_address(); break; case '{{CUSTOMER_NAME}}': $code = $order->get_customer_name(); break; case '{{CUSTOMER_PHONE}}': $code = $order->get( 'billing_phone' ); break; case '{{ORDER_ID}}': $code = $order->get( 'id' ); break; case '{{ORDER_URL}}': $code = esc_url( $order->get_view_link() ); break; case '{{PLAN_TITLE}}': $code = $order->get( 'plan_title' ); break; case '{{PRODUCT_TITLE}}': $code = $order->get( 'product_title' ); break; case '{{PRODUCT_TITLE_LINK}}': $permalink = esc_url( get_permalink( $order->get( 'product_id' ) ) ); if ( $permalink ) { $title = $this->set_merge_data( '{{PRODUCT_TITLE}}' ); $code = '<a href="' . $permalink . '">' . $title . '</a>'; } break; case '{{PRODUCT_TYPE}}': $obj = $order->get_product(); if ( $obj ) { $code = $obj->get_post_type_label( 'singular_name' ); } else { $code = _x( 'Item', 'generic product type description', 'lifterlms' ); } break; case '{{TRANSACTION_AMOUNT}}': $code = $transaction->get_price( 'amount' ); break; case '{{TRANSACTION_DATE}}': $code = $transaction->get_date( 'date', get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ); break; case '{{TRANSACTION_ID}}': $code = $transaction->get( 'id' ); break; case '{{TRANSACTION_SOURCE}}': $code = $transaction->get( 'gateway_source_description' ); break; } return $code; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.2.0 | Retrieve the customer's full address using the proper order's method. |
3.8.2 | Unknown. |
3.8.0 | Introduced. |