kreamweb
1/15/2017 - 7:56 AM

WooCommerce Order Number Integration

WooCommerce Order Number Integration

<?php 

if( defined( 'YITH_YWRAQ_PREMIUM' ) ){
    add_filter( 'ywraq_quote_number', 'ywraq_get_custom_order_number', 10, 1 );
 function ywraq_get_custom_order_number( $order_id ) {

 $custom_order_id = get_post_meta( $order_id, '_order_number', true );

 if( $custom_order_id!='' ){

 return $custom_order_id;
 }

 return $order_id;
 }
 
add_filter('ywraq_pdf_file_name','ywraq_pdf_file_name', 10, 2);

 function ywraq_pdf_file_name( $filename, $quote_id ){
  $custom_order_id = get_post_meta( $quote_id, '_order_number', true );
  $custom_order_id = ($custom_order_id == '' ) ? $quote_id : $custom_order_id;
  return 'proposal_number_'.$custom_order_id.'.pdf';
 }
 
}