Add Prefix And Suffix to Order Number With Date Serial For WooCommerce

Outline

    Original Post

    Add Prefix And Suffix to Order Number With Date Serial For WooCommerce


    Original Post

    Add Prefix And Suffix to Order Number With Date Serial For WooCommerce


    //--- Add Order Number Prefix and Suffix ---//
    function change_woocommerce_order_number( $order_id ) {
    	$order = new WC_Order($order_id);
    	$datetime = new DateTime($order->order_date);
    	$date = $datetime->format('Y-m-d');
    	$dateSerial = explode("-", $date);
    	$suffix = "anything";
      $new_order_id = $dateSerial[0].$dateSerial[1].$dateSerial[2].$order_id.$suffix;
      return $new_order_id;
    }
    add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' );
    

    Related Posts

    The Complete WordPress Customization Tutorial – Just Copy And Paste And Work



    Related Posts

    Aron

    A data scientist working in a retail company, with experience in web design and marketing. Recently dives into cryptocurrency and quantitative investing.

    facebook telegram
    Content Protection by DMCA.com

    Leave a Reply

    • Required fields are market * .
    • Your email address will not be published.
    • Please ensure your email address is correct, then you will get a notification once a new comment reply.

    Your email address will not be published. Required fields are marked *