noscript-img

Woocommerce Rechnungen Kundenkonto

Im Kundenkonto die Rechnungen zum download anbieten.

add_filter( 'woocommerce_my_account_my_orders_actions', 'german_market_woocommerce_my_account_my_orders_actions', 10, 2 );

/**
 * Add Download Invoice PDF Button to my-account page
 *
 * @wp-hook woocommerce_my_account_my_orders_actions
 * @param	Array $actions
 * @param 	WC_Order $order
 * @return 	Array
 */
function german_market_woocommerce_my_account_my_orders_actions( $actions, $order ) {

	$status 	= $order->get_status();

	if ( ( $status !== false ) && ( get_option( 'wp_wc_invoice_pdf_frontend_download_' . $status, 'no' ) == 'yes' ) ) {		

		$actions[ 'invoice' ] = array(

			'url' 	=> esc_url( wp_nonce_url( admin_url( 'admin-ajax.php?action=woocommerce_wp_wc_invoice_pdf_view_order_invoice_download&order_id=' . $order->get_id() ), 'wp-wc-invoice-pdf-download' ) ),
			'name' 	=> get_option( 'wp_wc_invoice_pdf_view_order_button_text', __( 'Download Invoice Pdf', 'woocommerce-german-market' ) ),

		);

	}

	return $actions;
}