Skip to content

Instantly share code, notes, and snippets.

@haet
Last active March 21, 2019 13:39
Show Gist options
  • Save haet/23c635968ecb7d88f39a989703011c76 to your computer and use it in GitHub Desktop.
Save haet/23c635968ecb7d88f39a989703011c76 to your computer and use it in GitHub Desktop.
Add custom Placeholder / Shortcode to Mailbuilder
<?php
add_filter( 'haet_mail_placeholder_menu', 'add_mailbuilder_placeholder' );
add_filter( 'haet_mail_order_placeholders', 'populate_mailbuilder_placeholder', 10, 3 );
function add_mailbuilder_placeholder( $placeholder_menu ){
if( is_array( $placeholder_menu ) ){
$placeholder_menu[] = array(
'text' => 'My Placholder Name',
'tooltip' => '[MY_PLACEHOLDER]',
);
}
return $placeholder_menu;
}
function populate_mailbuilder_placeholder( $order, $wc_order, $settings ){
$order['my_placeholder'] = 'your value';
return $order;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment