Created
September 26, 2024 06:41
-
-
Save prosvitco/2bae9779fa7b164bedb8226f01ecc35f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
/** | |
* Theme functions and definitions. | |
* | |
* For additional information on potential customization options, | |
* read the developers' documentation: | |
* | |
* https://developers.elementor.com/docs/hello-elementor-theme/ | |
* | |
* @package HelloElementorChild | |
*/ | |
if (!defined('ABSPATH')) { | |
exit; // Exit if accessed directly. | |
} | |
// | |
// This line of code disables add-to-cart | |
// | |
// add_filter( 'woocommerce_is_purchasable', '__return_false' ); | |
define('HELLO_ELEMENTOR_CHILD_VERSION', '2.0.0'); | |
/** | |
* Load child theme scripts & styles. | |
* | |
* @return void | |
*/ | |
function hello_elementor_child_scripts_styles() | |
{ | |
wp_enqueue_style( | |
'hello-elementor-child-style', | |
get_stylesheet_directory_uri() . '/style.css', | |
[ | |
'hello-elementor-theme-style', | |
], | |
HELLO_ELEMENTOR_CHILD_VERSION | |
); | |
} | |
add_action('wp_enqueue_scripts', 'hello_elementor_child_scripts_styles', 20); | |
add_action('woocommerce_before_add_to_cart_quantity', 'ts_quantity_minus_sign_wrapper_open', 5); | |
function ts_quantity_minus_sign_wrapper_open() | |
{ | |
echo '<div class="quantity-btns">'; | |
} | |
add_action('woocommerce_before_add_to_cart_quantity', 'ts_quantity_minus_sign', 10); | |
function ts_quantity_minus_sign() | |
{ | |
echo '<a class="qty-btn minus" >-</a>'; | |
} | |
add_action('woocommerce_after_add_to_cart_quantity', 'ts_quantity_plus_sign', 10); | |
function ts_quantity_plus_sign() | |
{ | |
echo '<a class="qty-btn plus" >+</a>'; | |
} | |
add_action('woocommerce_after_add_to_cart_quantity', 'ts_quantity_plus_sign_wrapper_close', 15); | |
function ts_quantity_plus_sign_wrapper_close() | |
{ | |
echo '</div>'; | |
} | |
add_action('wp_footer', 'ts_quantity_plus_minus'); | |
function ts_quantity_plus_minus() | |
{ | |
// To run this on the single product page | |
if (!is_product()) | |
return; | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function ($) { | |
$('form.cart').on('click', 'a.plus, a.minus', function () { | |
// Get current quantity values | |
var qty = $(this).closest('form.cart').find('.qty'); | |
var val = parseFloat(qty.val()); | |
var max = parseFloat(qty.attr('max')); | |
var min = parseFloat(qty.attr('min')); | |
var step = parseFloat(qty.attr('step')); | |
// Change the value if plus or minus | |
if ($(this).is('.plus')) { | |
if (max && (max <= val)) { | |
qty.val(max); | |
} else { | |
qty.val(val + step); | |
} | |
} else { | |
if (min && (min >= val)) { | |
qty.val(min); | |
} else if (val > 1) { | |
qty.val(val - step); | |
} | |
} | |
}); | |
}); | |
</script> | |
<?php | |
} | |
/** | |
* @snippet Hide Clear Link | WooCommerce Variable Products | |
* @how-to Get CustomizeWoo.com FREE | |
* @author Rodolfo Melogli | |
* @compatible WooCommerce 6 | |
* @community https://businessbloomer.com/club/ | |
*/ | |
add_filter('woocommerce_reset_variations_link', '__return_empty_string', 9999); | |
// Remove "Select options" button from (variable) products on the main WooCommerce shop page. | |
// add_filter( 'woocommerce_loop_add_to_cart_link', function( $product ) { | |
// global $product; | |
// if ( is_shop() && 'variable' === $product->product_type ) { | |
// return ''; | |
// } else { | |
// sprintf( '<a href="%s" data-quantity="%s" class="%s" %s>%s</a>', | |
// esc_url( $product->add_to_cart_url() ), | |
// esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ), | |
// esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ), | |
// isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '', | |
// esc_html( $product->add_to_cart_text() ) | |
// ); | |
// } | |
// } ); | |
/* PROJECT URL*/ | |
function project_url_shortcode() | |
{ | |
// Get the global post object | |
global $post; | |
// Check if we're inside a 'project' post type | |
if ('project' === get_post_type($post)) { | |
// Get the value of the custom field 'project_id' | |
$project_id = get_post_meta($post->ID, 'project_id', true); | |
// Create the URL | |
$url = site_url() . "/pages/projects#" . $project_id; | |
// Return the URL | |
return esc_url($url); | |
} | |
return ''; | |
} | |
add_shortcode('project_url', 'project_url_shortcode'); | |
add_action('woocommerce_admin_order_data_after_billing_address', 'add_invoice_address_field', 10, 1); | |
function add_invoice_address_field($order) | |
{ | |
woocommerce_wp_select(array( | |
'id' => '_invoice_address', | |
'label' => 'Invoice Address', | |
'options' => array( | |
'default' => 'Default Shop Address', | |
'location1' => 'Growing Facility', | |
'location2' => 'Biophilic Design Showroom', | |
), | |
)); | |
} | |
add_action('woocommerce_process_shop_order_meta', 'save_invoice_address_field', 10, 2); | |
function save_invoice_address_field($order_id, $post) | |
{ | |
update_post_meta($order_id, '_invoice_address', wc_clean($_POST['_invoice_address'])); | |
} | |
add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args'); | |
add_filter('woocommerce_default_catalog_orderby_options', 'custom_woocommerce_catalog_orderby'); | |
add_filter('woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby'); | |
// Apply custom args to main query | |
function custom_woocommerce_get_catalog_ordering_args($args) | |
{ | |
$orderby_value = isset($_GET['orderby']) ? wc_clean($_GET['orderby']) : apply_filters('woocommerce_default_catalog_orderby', get_option('woocommerce_default_catalog_orderby')); | |
if ('oldest_to_recent' == $orderby_value) { | |
$args['orderby'] = 'date'; | |
$args['order'] = 'ASC'; | |
} | |
return $args; | |
} | |
// Create new sorting method | |
function custom_woocommerce_catalog_orderby($sortby) | |
{ | |
$sortby['oldest_to_recent'] = __('Oldest to most recent', 'woocommerce'); | |
return $sortby; | |
} | |
/*new code*/ | |
add_filter('woocommerce_order_email_verification_required', '__return_false'); | |
function add_shipping_billing() | |
{ | |
$order_id = absint(get_query_var('order-pay')); | |
$order = wc_get_order($order_id); | |
?> | |
<!-- Display Information --> | |
<h2 class="woocommerce-column__title"><?php esc_html_e('Billing address', 'woocommerce'); ?></h2> | |
<address> | |
<?php echo wp_kses_post($order->get_formatted_billing_address(__('N/A', 'woocommerce'))); ?> | |
<?php if ($order->get_billing_phone()): ?> | |
<p class="woocommerce-customer-details--phone"><?php echo esc_html($order->get_billing_phone()); ?></p> | |
<?php endif; ?> | |
<?php if ($order->get_billing_email()): ?> | |
<p class="woocommerce-customer-details--email"><?php echo esc_html($order->get_billing_email()); ?></p> | |
<?php endif; ?> | |
<?php if ($order->get_billing_email()): ?> | |
<p class="woocommerce-customer-details--email"><?php echo esc_html($order->get_billing_email()); ?></p> | |
<?php endif; ?> | |
</address> | |
<h2 class="woocommerce-column__title"><?php esc_html_e('Shipping address', 'woocommerce'); ?></h2> | |
<address> | |
<?php echo wp_kses_post($order->get_formatted_shipping_address(__('N/A', 'woocommerce'))); ?> | |
</address> | |
<!-- Form --> | |
<h3><?php _e('Billing details', 'woocommerce'); ?></h3> | |
<?php do_action('woocommerce_before_checkout_billing_form', $order); ?> | |
<div class="woocommerce-billing-fields__field-wrapper"> | |
<?php | |
$fields = WC()->checkout->get_checkout_fields('billing'); | |
foreach ($fields as $key => $field) { | |
$field_name = $key; | |
if (is_callable(array($order, 'get_' . $field_name))) { | |
$field['value'] = $order->{"get_$field_name"}('edit'); | |
} else { | |
$field['value'] = $order->get_meta('_' . $field_name); | |
} | |
woocommerce_form_field($key, $field, $field['value']); | |
} | |
?> | |
</div> | |
<script> | |
jQuery(document).ready(function () { | |
jQuery('#address_checkbox').click(function () { | |
jQuery('.shippingaddsection').toggle(); | |
}); | |
}); | |
</script> | |
<?php | |
woocommerce_form_field('checkout_checkbox', array( // CSS ID | |
'type' => 'checkbox', | |
'class' => array('form-row mycheckbox'), // CSS Class | |
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'), | |
'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'), | |
'required' => false, // Mandatory or Optional | |
'id' => 'address_checkbox', | |
'label' => 'Shipping address is Different?', // Label and Link | |
)); | |
?> | |
<?php do_action('woocommerce_after_checkout_billing_form', $order); ?> | |
<div class="shippingaddsection" style="display:none;"> | |
<h3><?php _e('Shipping details', 'woocommerce'); ?></h3> | |
<?php do_action('woocommerce_before_checkout_shipping_form', $order); ?> | |
<div class="woocommerce-shipping-fields__field-wrapper"> | |
<?php | |
$fields = WC()->checkout->get_checkout_fields('shipping'); | |
foreach ($fields as $key => $field) { | |
$field_name = $key; | |
if (is_callable(array($order, 'get_' . $field_name))) { | |
$field['value'] = $order->{"get_$field_name"}('edit'); | |
} else { | |
$field['value'] = $order->get_meta('_' . $field_name); | |
} | |
woocommerce_form_field($key, $field, $field['value']); | |
} | |
?> | |
</div> | |
</div> | |
<?php do_action('woocommerce_after_checkout_shipping_form', $order); ?> | |
<?php | |
} | |
add_action('woocommerce_pay_order_before_submit', 'add_shipping_billing'); | |
add_action('woocommerce_before_pay_action', 'do_woocommerce_before_pay_action'); | |
function do_woocommerce_before_pay_action($order) | |
{ | |
$order->set_billing_first_name($_REQUEST['billing_first_name'] ? $_REQUEST['billing_first_name'] : null); | |
$order->set_billing_last_name($_REQUEST['billing_last_name'] ? $_REQUEST['billing_last_name'] : null); | |
$order->set_billing_company($_REQUEST['billing_company'] ? $_REQUEST['billing_company'] : null); | |
$order->set_billing_country($_REQUEST['billing_country'] ? $_REQUEST['billing_country'] : null); | |
$order->set_billing_address_1($_REQUEST['billing_address_1'] ? $_REQUEST['billing_address_1'] : null); | |
$order->set_billing_address_2($_REQUEST['billing_address_2'] ? $_REQUEST['billing_address_2'] : null); | |
$order->set_billing_city($_REQUEST['billing_city'] ? $_REQUEST['billing_city'] : null); | |
$order->set_billing_state($_REQUEST['billing_state'] ? $_REQUEST['billing_state'] : null); | |
$order->set_billing_postcode($_REQUEST['billing_postcode'] ? $_REQUEST['billing_postcode'] : null); | |
if ($_REQUEST['checkout_checkbox'] == 1) { | |
$order->set_shipping_first_name($_REQUEST['shipping_first_name'] ? $_REQUEST['shipping_first_name'] : null); | |
$order->set_shipping_last_name($_REQUEST['shipping_last_name'] ? $_REQUEST['shipping_last_name'] : null); | |
$order->set_shipping_company($_REQUEST['shipping_company'] ? $_REQUEST['shipping_company'] : null); | |
$order->set_shipping_country($_REQUEST['shipping_country'] ? $_REQUEST['shipping_country'] : null); | |
$order->set_shipping_address_1($_REQUEST['shipping_address_1'] ? $_REQUEST['shipping_address_1'] : null); | |
$order->set_shipping_address_2($_REQUEST['shipping_address_2'] ? $_REQUEST['shipping_address_2'] : null); | |
$order->set_shipping_city($_REQUEST['shipping_city'] ? $_REQUEST['shipping_city'] : null); | |
$order->set_shipping_state($_REQUEST['shipping_state'] ? $_REQUEST['shipping_state'] : null); | |
$order->set_shipping_postcode($_REQUEST['shipping_postcode'] ? $_REQUEST['shipping_postcode'] : null); | |
} else { | |
$order->set_shipping_first_name($_REQUEST['billing_first_name'] ? $_REQUEST['billing_first_name'] : null); | |
$order->set_shipping_last_name($_REQUEST['billing_last_name'] ? $_REQUEST['billing_last_name'] : null); | |
$order->set_shipping_company($_REQUEST['billing_company'] ? $_REQUEST['billing_company'] : null); | |
$order->set_shipping_country($_REQUEST['billing_country'] ? $_REQUEST['billing_country'] : null); | |
$order->set_shipping_address_1($_REQUEST['billing_address_1'] ? $_REQUEST['billing_address_1'] : null); | |
$order->set_shipping_address_2($_REQUEST['billing_address_2'] ? $_REQUEST['billing_address_2'] : null); | |
$order->set_shipping_city($_REQUEST['billing_city'] ? $_REQUEST['billing_city'] : null); | |
$order->set_shipping_state($_REQUEST['billing_state'] ? $_REQUEST['billing_state'] : null); | |
$order->set_shipping_postcode($_REQUEST['billing_postcode'] ? $_REQUEST['billing_postcode'] : null); | |
} | |
} | |
// Add admin email address field to Add Order page | |
function iconic_wc_ajax_variation_threshold($qty, $product) | |
{ | |
return 300; | |
} | |
add_filter('woocommerce_ajax_variation_threshold', 'iconic_wc_ajax_variation_threshold', 10, 2); | |
// START EDITS | |
add_filter('woocommerce_account_orders_columns', 'add_column_to_my_account_orders'); | |
function add_column_to_my_account_orders($columns) | |
{ | |
$columns['tracking'] = 'Tracking'; | |
return $columns; | |
} | |
add_action('woocommerce_my_account_my_orders_column_tracking', 'add_tracking_to_my_orders'); | |
function add_tracking_to_my_orders($order) | |
{ | |
$tracking_number = get_post_meta($order->get_id(), '_tracking_number', true); | |
if (!empty($tracking_number)) { | |
$tracking_link = get_post_meta($order->get_id(), '_tracking_link', true); | |
echo "<a href='{$tracking_link}' class='woocommerce-button button' target='_blank'>Track</a>"; | |
} else { | |
echo ' - '; | |
} | |
} | |
add_action('woocommerce_order_details_after_order_table', 'add_tracking_to_order_details'); | |
function add_tracking_to_order_details($order) | |
{ | |
$tracking_number = get_post_meta($order->get_id(), '_tracking_number', true); | |
if (!empty($tracking_number)) { | |
$tracking_link = get_post_meta($order->get_id(), '_tracking_link', true); | |
echo "<h2 class='woocommerce-column__title'>Tracking Number: <a href='{$tracking_link}' target='_blank'>{$tracking_number}</a></h2>"; | |
} | |
} | |
add_action('woocommerce_email_before_order_table', 'add_tracking_to_email', 10, 4); | |
function add_tracking_to_email($order, $sent_to_admin, $plain_text, $email) | |
{ | |
if (!empty($email->id) && $email->id === 'customer_completed_order') { | |
$tracking_number = get_post_meta($order->get_id(), '_tracking_number', true); | |
if (!empty($tracking_number)) { | |
$tracking_provider = get_post_meta($order->get_id(), '_tracking_provider', true); | |
$date_shipped = get_post_meta($order->get_id(), '_date_shipped', true); | |
$tracking_link = get_post_meta($order->get_id(), '_tracking_link', true); | |
if (is_numeric($date_shipped)) { | |
$date_shipped = date('m/d/Y', $date_shipped); | |
} | |
echo "<h3>Tracking Details:</h2>"; | |
echo "<p>Shipped on {$date_shipped} via {$tracking_provider}</p>"; | |
echo "<p>Tracking Number: <a href='{$tracking_link}'>{$tracking_number}</a></p>"; | |
} | |
} | |
} | |
function p_find_tracking_info($string){ | |
// Initialize variables | |
$tracking_provider = null; | |
$tracking_number = null; | |
$date_shipped = null; | |
// Regex patterns to match different shipment info | |
preg_match('/Tracking Provider: *(.*)/', $string, $provider_matches); | |
preg_match('/Tracking Number: (.*)/', $string, $number_matches); | |
preg_match('/Easyship Shipment ID: (.*)/', $string, $easyship_matches); | |
preg_match('/Tracking Link: (.*)/', $string, $tracking_link_matches); | |
preg_match('/Shipped on (\d{2}\/\d{2}\/\d{4}) via (.+?), \[.*\], Tracking number (\S+)\s/', $string, $old_matches); | |
if ($provider_matches && $number_matches) { | |
$tracking_provider = $provider_matches[1]; | |
$tracking_number = $number_matches[1]; | |
} elseif ($old_matches) { // Check the new template pattern | |
$date_shipped = DateTime::createFromFormat('m/d/Y', $old_matches[1])->getTimestamp(); | |
$tracking_provider = $old_matches[2]; | |
$tracking_number = $old_matches[3]; | |
} | |
return [ | |
'tracking_provider' => $tracking_provider, | |
'tracking_number' => $tracking_number, | |
'easyship_id' => !empty($easyship_matches) ? $easyship_matches[1] : null, | |
'tracking_link' => !empty($tracking_link_matches) ? $tracking_link_matches[1] : null, | |
'date_shipped' => !empty($date_shipped) ? $date_shipped : null, | |
]; | |
} | |
add_action('woocommerce_order_note_added', 'p_update_order_tracking_info', 10, 2); | |
function p_update_order_tracking_info($order_note_id, $order){ | |
$note = wc_get_order_note($order_note_id); | |
if (!empty($note->added_by) && $note->added_by === 'system') { | |
$tracking_info = p_find_tracking_info($note->content); | |
if (!empty($tracking_info['tracking_provider']) && !empty($tracking_info['tracking_number'])) { | |
update_post_meta($order->get_id(), '_tracking_provider', $tracking_info['tracking_provider']); | |
update_post_meta($order->get_id(), '_tracking_number', $tracking_info['tracking_number']); | |
if (!empty($tracking_info['easyship_id'])) { | |
update_post_meta($order->get_id(), '_easyship_id', $tracking_info['easyship_id']); | |
} | |
if (!empty($tracking_info['tracking_link'])) { | |
update_post_meta($order->get_id(), '_tracking_link', $tracking_info['tracking_link']); | |
} | |
if (!empty($tracking_info['date_shipped'])) { | |
update_post_meta($order->get_id(), '_date_shipped', $tracking_info['date_shipped']); | |
} else { | |
update_post_meta($order->get_id(), '_date_shipped', $note->date_created->getTimestamp()); | |
} | |
} | |
} | |
} | |
function p_update_all_orders_tracking_info() | |
{ | |
$orders = wc_get_orders([ | |
'limit' => -1, | |
'status' => 'completed', | |
'orderby' => 'date', | |
'order' => 'DESC', | |
'date_modified' => '>' . strtotime('-1 day'), | |
]); | |
foreach ($orders as $order) { | |
$_tracking_provider = get_post_meta($order->get_id(), '_tracking_provider', true); | |
$_date_shipped = get_post_meta($order->get_id(), '_date_shipped', true); | |
$_tracking_number = get_post_meta($order->get_id(), '_tracking_number', true); | |
if (!empty($_tracking_provider) && !empty($_date_shipped) && !empty($_tracking_number)) { | |
continue; | |
} | |
$order_notes = wc_get_order_notes([ | |
'order_id' => $order->get_id(), | |
'type' => 'system', | |
]); | |
foreach ($order_notes as $note) { | |
$tracking_info = p_find_tracking_info($note->content); | |
if (!empty($tracking_info['tracking_provider']) && !empty($tracking_info['tracking_number'])) { | |
update_post_meta($order->get_id(), '_tracking_provider', $tracking_info['tracking_provider']); | |
update_post_meta($order->get_id(), '_tracking_number', $tracking_info['tracking_number']); | |
if (!empty($tracking_info['easyship_id'])) { | |
update_post_meta($order->get_id(), '_easyship_id', $tracking_info['easyship_id']); | |
} | |
if (!empty($tracking_info['tracking_link'])) { | |
update_post_meta($order->get_id(), '_tracking_link', $tracking_info['tracking_link']); | |
} | |
if (!empty($tracking_info['date_shipped'])) { | |
update_post_meta($order->get_id(), '_date_shipped', $tracking_info['date_shipped']); | |
} else { | |
update_post_meta($order->get_id(), '_date_shipped', $note->date_created->getTimestamp()); | |
} | |
var_dump("Order {$order->get_id()} updated with tracking info"); | |
break; | |
} | |
} | |
} | |
} | |
// add_action('init', function () { | |
// if(isset($_GET['dev'])){ | |
// $order_notes = wc_get_order_notes([ | |
// 'order_id' => 21081, | |
// 'type' => 'system', | |
// ]); | |
// $order = wc_get_order(21637); | |
// $new_note = wc_create_order_note( | |
// $order->get_id(), | |
// $order_notes[0]->content, | |
// false, | |
// false | |
// ); | |
// // dd($order); | |
// } | |
// }); | |
function dd($data) | |
{ | |
echo "<pre>"; | |
var_dump($data); | |
echo "</pre>"; | |
die(); | |
} | |
///Moved files from Code app | |
add_action( 'wpo_wcpdf_custom_styles', 'dh_wpo_wcpdf_custom_styles', 10, 2 ); | |
function dh_wpo_wcpdf_custom_styles ( $document_type, $document ) { | |
?> | |
body { | |
font-family: sans-serif; | |
} | |
<?php | |
} | |
function dh_add_bcc_all_emails( $headers, $object ) { | |
$headers = array( | |
$headers, | |
'Bcc: Me <[email protected]>' ."\r\n", | |
); | |
return $headers; | |
} | |
add_filter( 'woocommerce_email_headers', 'dh_add_bcc_all_emails', 10, 2 ); | |
add_shortcode( 'dh_show_order_shipment', 'dh_get_tracking_info' ); | |
function dh_get_tracking_info( $atts = array() ) { | |
ob_start(); | |
$atts = shortcode_atts( array( | |
'p_id' => false, | |
), $atts, 'dh_show_order_shipment' ); | |
if($atts['p_id'] != false) { | |
$order_ID = $atts['p_id']; | |
$order = wc_get_order( $order_ID ); | |
$order_status = $order->get_status(); | |
$order_notes = dh_get_private_order_notes($order_ID); | |
$order_notes_last_index = sizeof($order_notes) - 1; | |
$shipment_details_notes = $order_notes[$order_notes_last_index]; | |
$note_content = $shipment_details_notes['note_content']; | |
if($order_status == 'completed') { | |
$note_content_arr = explode(", ", $note_content); | |
if(is_array($note_content_arr)) { | |
$note_shipped = $note_content_arr[0]; | |
$note_tracking_number = $note_content_arr[1] ?? ''; // Default to empty string if not set | |
if (!empty($note_tracking_number)) { | |
$note_tracking_number = str_replace("Order status changed from Processing to Completed."," ", $note_tracking_number); | |
} | |
echo '<b>Tracking Details: </b><br>'; | |
echo $note_shipped.'<br>'; | |
echo $note_tracking_number.'<br>'; | |
} | |
} | |
} | |
return ob_get_clean(); | |
} | |
function dh_get_private_order_notes($order_id){ | |
global $wpdb; | |
$table_perfixed = $wpdb->prefix . 'comments'; | |
$results = $wpdb->get_results(" | |
SELECT * | |
FROM $table_perfixed | |
WHERE `comment_post_ID` = $order_id | |
AND `comment_type` LIKE 'order_note' | |
"); | |
foreach($results as $note){ | |
$order_note[] = array( | |
'note_id' => $note->comment_ID, | |
'note_content' => $note->comment_content, | |
); | |
} | |
return $order_note; | |
} | |
add_action( 'woocommerce_email_before_order_table', 'dh_modifyEmailText', 10, 4 ); | |
function dh_modifyEmailText($order, $sent_to_admin, $plain_text, $email){ | |
if($order->get_status() == 'completed') { | |
$order_ID = $order->get_id(); | |
echo do_shortcode('[dh_show_order_shipment p_id="'.$order_ID.'"]'); | |
} | |
} | |
// END EDITS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment