Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshlinRejo/b7f733152632a0e7b62cf2044940493e to your computer and use it in GitHub Desktop.
Save AshlinRejo/b7f733152632a0e7b62cf2044940493e to your computer and use it in GitHub Desktop.
Email Customizer: Load additional data from the plugin WooCommerce Checkout Manager by QuadLayers
/**
* To load the additional shortcode in Woo Email Template
*
* @param $shortcodes array
* @return array
* */
function woo_email_drag_and_drop_builder_load_additional_shortcode_method($shortcodes){
$shortcodes['additional_fields_from_checkout_manager'] = "Aditional details";
return $shortcodes;
}
add_filter('woo_email_drag_and_drop_builder_load_additional_shortcode', 'woo_email_drag_and_drop_builder_load_additional_shortcode_method', 10);
/**
* To send the additional shortcode value
*
* @param $shortcodes array
* @param $order object //might be empty for email template which doesn't has order
* @param $sending_email boolean
* @return array
* */
function woo_email_drag_and_drop_builder_load_additional_shortcode_data_method($shortcodes, $order, $sending_email){
$shortcodes['additional_fields_from_checkout_manager'] = '';
ob_start();
echo '<div class="order_data_column">';
do_action( 'woocommerce_admin_order_data_after_shipping_address', $order );
echo '</div>';
$html = ob_get_contents();
ob_clean();
ob_get_clean();
$shortcodes['additional_fields_from_checkout_manager'] = $html;
return $shortcodes;
}
add_filter('woo_email_drag_and_drop_builder_load_additional_shortcode_data', 'woo_email_drag_and_drop_builder_load_additional_shortcode_data_method', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment