Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF invoice button on sub order #1939

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions includes/Order/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public function __construct() {
add_action( 'woocommerce_reduce_order_stock', [ $this, 'restore_reduced_order_stock' ] );

add_action( 'woocommerce_reduce_order_stock', [ $this, 'handle_order_notes_for_suborder' ], 99 );

// Suborder pdf button
add_filter( 'dokan_my_account_my_sub_orders_actions', [ $this, 'suborder_pdf_invoice_button' ], 10, 2 );
}

/**
Expand Down Expand Up @@ -109,7 +112,7 @@ public function on_order_status_change( $order_id, $old_status, $new_status, $or
/**
* If `exclude_cod_payment` is enabled, don't include the fund in vendor's withdrawal balance.
*
* @since DOKAN_LITE_SINCE
* @since DOKAN_SINCE
*/
$exclude_cod_payment = 'on' === dokan_get_option( 'exclude_cod_payment', 'dokan_withdraw', 'off' );

Expand Down Expand Up @@ -396,7 +399,7 @@ public function restore_reduced_order_stock( $order ) {
/**
* Handle stock level wrong calculation in order notes for suborder
*
* @since DOKAN_LITE_SINCE
* @since DOKAN_SINCE
*
* @param WC_Order $order
*
Expand Down Expand Up @@ -434,4 +437,23 @@ public function handle_order_notes_for_suborder( $order ) {
}
}
}

/**
* PDF Invoices & Packing Slips for WooCommerce plugin integration on suborder section.
*
* @since DOKAN_SINCE
*
* @param $actions
* @param $order
*
* @return mixed
*/
public function suborder_pdf_invoice_button( $actions, $order ) {
$woocommerce_all_actions = apply_filters( 'woocommerce_my_account_my_orders_actions', $actions, $order );

if ( isset( $woocommerce_all_actions['invoice'] ) ) {
$actions['action'] = $woocommerce_all_actions['invoice'];
}
return $actions;
}
}
Loading