0% found this document useful (0 votes)
26 views

Button Code

This document contains code that adds a custom action to the WooCommerce admin order screen. The code retrieves order details like the billing email, id, date, name, total, shipping address details, currency, and status. It then generates a link to send an email to the customer containing these order details.

Uploaded by

Muhammad Tayyab
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Button Code

This document contains code that adds a custom action to the WooCommerce admin order screen. The code retrieves order details like the billing email, id, date, name, total, shipping address details, currency, and status. It then generates a link to send an email to the customer containing these order details.

Uploaded by

Muhammad Tayyab
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

add_action( 'woocommerce_admin_order_actions', 'add_content_to_wcactions_column');

function add_content_to_wcactions_column() {

global $the_order;

if( $email = $the_order->get_billing_email() ){


$id = $the_order->get_id();
$date = $the_order->get_date_created();
$name = $the_order->get_billing_first_name();
$total = $the_order->get_total();

$shippingfirstname = $the_order->get_shipping_first_name();
$shippingsecondname = $the_order->get_shipping_last_name();

$address1 = $the_order->get_shipping_address_1();
$address2 = $the_order->get_shipping_address_2();
$postcode = $the_order->get_shipping_postcode();
$shippingcity = $the_order->get_shipping_city();
$shippingstate = $the_order->get_shipping_state();
$shippingcountry = $the_order->get_shipping_country();

$currency = $the_order->get_currency();

$status = $the_order->get_status();

echo '<a class="button" href="mailto:'.$email.'?subject=p&body=HY%20'.$name.',


%0AYour%20Order%20details%20are%20as%20follows%0AOrder%20ID%20:'.$id.'%0AOrder
%20Status%20:'.$status.'%0AOrder%20Total%20:'.$total.''.$currency.'%0A%0AOrder
%20Date%20:'.$date.'%0AShipping%20Address%20:'.$shippingfirstname.'%20'.
$shippingsecondname.','.$shippingstate.','.$address1.','.$address2.','.
$postcode.','.$shippingcity.'">label</a>';
}
}

You might also like