Table of Contents
Shortcodes #
Order Shortcodes #
- [[order_billing_address]]
- [[order_billing_email]]
- [[order_billing_first_name]]
- [[order_billing_last_name]]
- [[order_billing_phone]]
- [[order_cancel_url]]
- [[order_checkout_payment_url]]
- [[order_customer_note]]
- [[order_customer_order_notes]]
- [[order_date]]
- [[order_details]]
- [[order_downloads]]
- [[order_edit_url]]
- [[order_func]]
- [[order_id]]
- [[order_item_meta]]
- [[order_item_names]]
- [[order_item_product_ids]]
- [[order_item_product_images]]
- [[order_meta]]
- [[order_number]]
- [[order_payment_method_id]]
- [[order_payment_method_title]]
- [[order_received_url]]
- [[order_shipping_address]]
- [[order_shipping_address_map_url]]
- [[order_shipping_method]]
- [[order_shipping_total]]
- [[order_total]]
- [[order_total_excl_tax]]
- [[order_total_items_count]]
- [[order_total_items_qty]]
- [[order_total_tax]]
- [[order_user_data]]
- [[order_user_id]]
- [[order_user_meta]]
- [[order_view_url]]
Other Shortcodes #
- [[generate_coupon_code]]
- [[user_prop]]
- [[product_func]]
General Shortcodes #
- [[if][/if]]
- [[clear]]
- [[site_title]]
- [[site_address]]
- [[translate]]
if
shortcode #
The if
shortcode allows for conditional output of content.
Attributes #
value1
– First value to compare. You can use shortcodes here by replacing
[
and]
with{
and}
, for example, if you’d need to compare order total:value1="{order_total}"
.value2
– Second value to compare. You can use shortcodes here, similar as it is invalue1
.operator
– Comparison operator. Can beequal
,not_equal
,less
,less_or_equal
,greater
orgreater_or_equal
.
Examples #
[[if value1="{order_meta key='_my_meta_key'}" operator="greater" value2="0"]Content to output.[/if]]
You can use shortcodes in content as well:
[[if value1="{order_meta key='_my_meta_key'}" operator="greater" value2="0"][order_shipping_method][/if]]
order_func
shortcode #
The order_func
shortcode allows you to call the WC_Order
class functions.
Attributes #
func
– Function name.
Examples #
[[order_func func="get_currency"]]
[[order_func func="get_customer_ip_address"]]
order_meta
shortcode #
The order_meta
shortcode allows you to display order meta by key.
Attributes #
key
– Meta key.
Examples #
[[order_meta key="_billing_city"]]
[[order_meta key="_shipping_city"]]
Custom Shortcodes #
You can create your own custom shortcodes, e.g.:
add_shortcode( 'my_order_shipping_city', function ( $atts ) { if ( function_exists( 'alg_wc_custom_emails' ) && ! empty( alg_wc_custom_emails()->core->shortcodes->order ) ) { $order = alg_wc_custom_emails()->core->shortcodes->order; return $order->get_shipping_city(); } } );