Created
December 13, 2019 07:50
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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