• Resolved darkallman

    (@darkallman)


    Onderstaande functie blijkt ineens niet meer te werken.
    Ik kan me voorstellen dat de pluginrewrite hiervoor gezorgt heeft.
    Hoe krijg ik nu mijn trackntrace handmatig in een email?

    public function track_trace_email( $order, $sent_to_admin ) {
    
    	if ( $sent_to_admin ) return;
    
    	if ( in_array( $email->id, array('wc_sa_ordersent', 'wc_sa_ordersend-invoice-1', 'wc_sa_ordersend-invoice-2') ) ) { 
    		$order_id = WCX_Order::get_id( $order );
    
    		$tracktrace_links = WooCommerce_MyParcel()->admin->get_tracktrace_links ( $order_id );
    		if ( !empty($tracktrace_links) ) {
    			$email_text = __( 'You can track your order with the following PostNL track&trace code:', 'woocommerce-myparcel' );
    			$email_text = apply_filters( 'wcmyparcel_email_text', $email_text, $order );
    			?>
    			<p><?php echo $email_text.' '.implode(', ', $tracktrace_links); ?></p>
    	
    			<?php
    		}		
    	}
    }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter darkallman

    (@darkallman)

    Fixed with some changed code:

    public function track_trace_email( $order, $sent_to_admin, $plain_text, $email ) {
    
    	if ( $sent_to_admin ) return;
    
    	if ( in_array( $email->id, array('wc_sa_ordersent', 'wc_sa_ordersend-invoice-1', 'wc_sa_ordersend-invoice-2') ) ) { 
    		$order_data = $order->get_data();
    
    		$tracktrace_links = WooCommerce_MyParcel()->admin->get_tracktrace_links ( $order_data['id'] );
    		if ( !empty($tracktrace_links) ) {
    			$email_text = __( 'You can track your order with the following PostNL track&trace code:', 'woocommerce-myparcel' );
    			$email_text = apply_filters( 'wcmyparcel_email_text', $email_text, $order );
    			?>
    			<p><?php echo $email_text.' '.implode(', ', $tracktrace_links); ?></p>
    	
    			<?php
    		}		
    	}
    }	
    • This reply was modified 5 years, 11 months ago by darkallman.
Viewing 1 replies (of 1 total)
  • The topic ‘Get Track n Trace’ is closed to new replies.