Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wcfm_orders_module_actions', function($actions, $order_id, $the_order) {
- if(!current_user_can('administrator')) return $actions;
- $items = $the_order->get_items( 'line_item' );
- $vendors = array();
- foreach($items as $item) {
- $product_id = $item->get_product_id();
- $vendor_id = wcfm_get_vendor_id_by_post( $product_id );
- if( !wcfm_is_vendor( $vendor_id ) || in_array($vendor_id, $vendors)) continue;
- $vendors[] = $vendor_id;
- $store_name = wcfm_get_vendor_store_name($vendor_id);
- $url = add_query_arg(
- array(
- 'action' => 'wcfm_order_pdf_invoice',
- 'template_type' => 'invoice',
- 'order_id' => $order_id,
- 'vendor_id' => $vendor_id
- ),
- admin_url('admin-ajax.php'));
- $actions .= '<a class="wcfm_pdf_invoice wcfm-action-icon" target="_blank" href="'. esc_url($url) .'" data-vendorid="'.$vendor_id.'" data-orderid="'.$order_id.'"><span class="wcfmfa fa-currence text_tip" data-tip="'.esc_attr__('Commission Invoice for ', 'wc-frontend-manager-ultimate').$store_name.'">'.get_woocommerce_currency_symbol().'</span></a>';
- }
- return $actions;
- }, 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement