Here we learn about how to assign an order to a different user in WooCommerce.
Custom code copied and paste into your child theme’s functions.php or custom plugin file.
Example 1: Pass user id you want to assign order using manually.
<?php function myblog_replace_user_id_with_session_id(){ //pass user id you want to assign order. $set_user_id = '2'; return $set_user_id; } add_filter( 'woocommerce_checkout_customer_id', 'myblog_replace_user_id_with_session_id' );
Example 2: Pass user id you want to assign order using session.
<?php function myblog_replace_user_id_with_session_id(){ if( !session_id() ){ session_start(); } if( isset( $_SESSION['order_by_user_id'] ) ){ //pass user id you want to assign order. return $_SESSION['order_by_user_id']; } } add_filter( 'woocommerce_checkout_customer_id', 'myblog_replace_user_id_with_session_id' ); ?>
OUTPUT:
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular
In this article, we have to show Create and Used PIPE in angular