• Resolved ayssono

    (@ayssono)


    Hello!
    I have a value in a custom field, which is connected to the user and not to posts or pages.

    I have this code to get this value and want to use the value for the prefix of the order number:
    $userFHJcustomerID = apply_filters( 'c2c_get_current_user_custom', 'Kundennummer' );
    I use the plugin https://de.www.ads-software.com/plugins/get-user-custom-field-values/ for this step and that works fine.
    But I don’t get – with my code – the prefix to the order number at every place of my woocommerce installation. So, I thought, your plugin looks great and maybe this plugin could help, if I can add the value of the user custom field in the prefix of your plugin.

    Do you see any chance to get this to work?
    Maybe with another solution than mine above?

    I wouldn’t have any problem to order your plugin after ??

    Kind regards,

    Klaus

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @ayssono,

    Please try using below filter to have the meta value as prefix.

    add_filter('wt_order_number_sequence_prefix', 'wt_add_custom_prefix', 10, 2);
    function wt_add_custom_prefix($perfix,$order_id)
    {
    	$userFHJcustomerID = apply_filters( 'c2c_get_current_user_custom', 'Kundennummer' );
    	if(!empty($userFHJcustomerID))
    	{
    		$prefix=$userFHJcustomerID.'-';
    	}
        return $prefix;
    }
    Thread Starter ayssono

    (@ayssono)

    Hello!

    GREAT GREAT GREAT!

    PERFECT, that works as it should!!!

    THANK YOU!

    Just a little question:
    Is it able to make the order number with leading numbers, counting up?
    At the moment, when I set the starting number to 00001, it changes to 1.
    If not, it isn’t not a big thing, just asking ??

    THANK YOU AGAIN!

    Kind regards,

    Klaus

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Prefix from custom field at user’ is closed to new replies.