Changeset 3148545
- Timestamp:
- 09/09/2024 09:18:17 AM (18 months ago)
- Location:
- revechat
- Files:
-
- 2 edited
-
tags/6.2.2/revechat.php (modified) (4 diffs)
-
trunk/revechat.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
revechat/tags/6.2.2/revechat.php
r3060324 r3148545 80 80 81 81 $user_id = apply_filters( 'determine_current_user', false ); 82 $customer Id=wp_set_current_user( $user_id );83 84 85 WC()->customer = new WC_Customer( $customer Id, true );82 $customer=wp_set_current_user( $user_id ); 83 84 85 WC()->customer = new WC_Customer( $customer, true ); 86 86 WC()->cart = new WC_Cart(); 87 87 88 $response = new WP_REST_Response($this->getCartPayload($customer Id), 200);88 $response = new WP_REST_Response($this->getCartPayload($customer), 200); 89 89 90 90 … … 93 93 return $response; 94 94 95 } 95 } 96 96 97 97 … … 102 102 * 103 103 */ 104 public function getCartPayload($cu stomerId)104 public function getCartPayload($currentCustomer) 105 105 { 106 106 $products = array(); … … 124 124 125 125 126 if (is _numeric($customerId))126 if (isset($currentCustomer) && isset($currentCustomer->ID) ) 127 127 { 128 $customer->customerId = $cu stomerId;128 $customer->customerId = $currentCustomer->ID; 129 129 } 130 130 -
revechat/trunk/revechat.php
r3060324 r3148545 80 80 81 81 $user_id = apply_filters( 'determine_current_user', false ); 82 $customer Id=wp_set_current_user( $user_id );83 84 85 WC()->customer = new WC_Customer( $customer Id, true );82 $customer=wp_set_current_user( $user_id ); 83 84 85 WC()->customer = new WC_Customer( $customer, true ); 86 86 WC()->cart = new WC_Cart(); 87 87 88 $response = new WP_REST_Response($this->getCartPayload($customer Id), 200);88 $response = new WP_REST_Response($this->getCartPayload($customer), 200); 89 89 90 90 … … 93 93 return $response; 94 94 95 } 95 } 96 96 97 97 … … 102 102 * 103 103 */ 104 public function getCartPayload($cu stomerId)104 public function getCartPayload($currentCustomer) 105 105 { 106 106 $products = array(); … … 124 124 125 125 126 if (is _numeric($customerId))126 if (isset($currentCustomer) && isset($currentCustomer->ID) ) 127 127 { 128 $customer->customerId = $cu stomerId;128 $customer->customerId = $currentCustomer->ID; 129 129 } 130 130
Note: See TracChangeset
for help on using the changeset viewer.