File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -47,9 +47,10 @@ class Customer extends Model {
4747	 * Customer constructor 
4848	 * 
4949	 * @param \WC_Customer|int|string $id - User ID. 
50+ 	 * @param bool                    $is_session - Whether the customer is a session. 
5051	 */ 
51- 	public  function  __construct ( $ id'session '  ) {
52- 		$ this data                 = 'session '  === $ id\WC  ()->customer  : new  WC_Customer ( absint ( $ id
52+ 	public  function  __construct ( $ id'session ' ,  $ is_session  =  false  ) {
53+ 		$ this data                 = 'session '  === $ id\WC  ()->customer  : new  WC_Customer ( absint ( $ id,  $ is_session 
5354		$ allowed_restricted_fields
5455			'isRestricted ' ,
5556			'isPrivate ' ,
Original file line number Diff line number Diff line change @@ -66,6 +66,10 @@ public static function get_input_fields() {
6666					'description '  => __ ( 'Meta data. ' , 'wp-graphql-woocommerce '  ),
6767					'type '         => [ 'list_of '  => 'MetaDataInput '  ],
6868				],
69+ 				'isSession '              => [
70+ 					'type '         => 'Boolean ' ,
71+ 					'description '  => __ ( 'Whether to save changes on the session or in the database ' , 'wp-graphql-woocommerce '  ),
72+ 				],
6973			]
7074		);
7175	}
@@ -93,6 +97,7 @@ public static function get_output_fields() {
9397	 */ 
9498	public  static  function  mutate_and_get_payload () {
9599		return  static  function  ( $ inputAppContext $ contextResolveInfo $ info
100+ 			$ is_sessionisset ( $ input'isSession ' ] ) ? $ input'isSession ' ] : false ;
96101			$ session_onlyempty ( $ input'id ' ] ) && ! is_user_logged_in ();
97102			$ payloadnull ;
98103
@@ -116,7 +121,7 @@ public static function mutate_and_get_payload() {
116121			$ customer_argsprepare_customer_props ( $ input'update '  );
117122
118123			// Create customer object. 
119- 			$ customer$ session_onlynew  WC_Customer ( $ payload'id ' ] ) : \WC  ()->customer ;
124+ 			$ customer$ session_onlynew  WC_Customer ( $ payload'id ' ],  $ is_session \WC  ()->customer ;
120125
121126			// Copy billing address as shipping address. 
122127			if  ( isset ( $ input'shippingSameAsBilling ' ] ) && $ input'shippingSameAsBilling ' ] ) {
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments