Add an order action to 'create credit note'
This commit is contained in:
parent
0b05f10995
commit
72396bf987
|
@ -20,8 +20,9 @@ class WC_Meta_Box_Order_Actions {
|
|||
public static function output( $post ) {
|
||||
global $theorder;
|
||||
|
||||
if ( ! is_object( $theorder ) )
|
||||
if ( ! is_object( $theorder ) ) {
|
||||
$theorder = get_order( $post->ID );
|
||||
}
|
||||
|
||||
$order = $theorder;
|
||||
?>
|
||||
|
@ -34,10 +35,9 @@ class WC_Meta_Box_Order_Actions {
|
|||
<option value=""><?php _e( 'Actions', 'woocommerce' ); ?></option>
|
||||
<optgroup label="<?php _e( 'Resend order emails', 'woocommerce' ); ?>">
|
||||
<?php
|
||||
$mailer = WC()->mailer();
|
||||
|
||||
$mailer = WC()->mailer();
|
||||
$available_emails = apply_filters( 'woocommerce_resend_order_emails_available', array( 'new_order', 'customer_processing_order', 'customer_completed_order', 'customer_invoice' ) );
|
||||
$mails = $mailer->get_emails();
|
||||
$mails = $mailer->get_emails();
|
||||
|
||||
if ( ! empty( $mails ) ) {
|
||||
foreach ( $mails as $mail ) {
|
||||
|
@ -48,7 +48,8 @@ class WC_Meta_Box_Order_Actions {
|
|||
}
|
||||
?>
|
||||
</optgroup>
|
||||
<option value="regenerate_download_permissions"><?php _e( 'Generate Download Permissions', 'woocommerce' ); ?></option>
|
||||
<option value="regenerate_download_permissions"><?php _e( 'Generate download permissions', 'woocommerce' ); ?></option>
|
||||
<option value="create_credit_note"><?php _e( 'Create credit note', 'woocommerce' ); ?></option>
|
||||
<?php foreach( apply_filters( 'woocommerce_order_actions', array() ) as $action => $title ) { ?>
|
||||
<option value="<?php echo $action; ?>"><?php echo $title; ?></option>
|
||||
<?php } ?>
|
||||
|
@ -60,10 +61,11 @@ class WC_Meta_Box_Order_Actions {
|
|||
<li class="wide">
|
||||
<div id="delete-action"><?php
|
||||
if ( current_user_can( "delete_post", $post->ID ) ) {
|
||||
if ( ! EMPTY_TRASH_DAYS )
|
||||
if ( ! EMPTY_TRASH_DAYS ) {
|
||||
$delete_text = __( 'Delete Permanently', 'woocommerce' );
|
||||
else
|
||||
} else {
|
||||
$delete_text = __( 'Move to Trash', 'woocommerce' );
|
||||
}
|
||||
?><a class="submitdelete deletion" href="<?php echo esc_url( get_delete_post_link( $post->ID ) ); ?>"><?php echo $delete_text; ?></a><?php
|
||||
}
|
||||
?></div>
|
||||
|
@ -119,6 +121,11 @@ class WC_Meta_Box_Order_Actions {
|
|||
delete_post_meta( $post_id, '_download_permissions_granted' );
|
||||
wc_downloadable_product_permissions( $post_id );
|
||||
|
||||
} elseif ( $action = 'create_credit_note' ) {
|
||||
|
||||
wp_redirect( admin_url( 'post-new.php?post_type=wc_credit_note&order_id=' . $post_id ) );
|
||||
exit;
|
||||
|
||||
} else {
|
||||
|
||||
do_action( 'woocommerce_order_action_' . sanitize_title( $action ), $order );
|
||||
|
|
Loading…
Reference in New Issue