Changeset 3084387
- Timestamp:
- 05/10/2024 07:35:44 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
stan-checkout/trunk/includes/classes/class-wc-stan-checkout-button.php
r3084379 r3084387 37 37 add_action( 'woocommerce_before_cart_totals', array( $this, 'display_stan_checkout_button_in_cart_page' ), 5 ); 38 38 add_action( 'woocommerce_widget_shopping_cart_buttons', array( $this, 'display_stan_checkout_button_in_mini_cart_page' ), 10 ); 39 add_action( 'woocommerce_ after_add_to_cart_button', array( $this, 'display_stan_checkout_button_in_product_page' ), 10 );39 add_action( 'woocommerce_before_add_to_cart_button', array( $this, 'display_stan_checkout_button_in_product_page' ), 10 ); 40 40 } 41 41 … … 109 109 */ 110 110 public function init_stan_checkout_button( $attrs ) { 111 $stan_session_id = wp_generate_uuid4(); 112 111 113 if ( ! isset( $_COOKIE[ STAN_SESSION_ID_COOKIE ] ) ) { 112 wc_setcookie( STAN_SESSION_ID_COOKIE, wp_generate_uuid4(), 0, true, true ); 114 wc_setcookie( STAN_SESSION_ID_COOKIE, $stan_session_id, 0, true, true ); 115 } else { 116 $stan_session_id = $_COOKIE[ STAN_SESSION_ID_COOKIE ]; 113 117 } 114 118 115 if ( isset( $_COOKIE[ STAN_SESSION_ID_COOKIE ] ) &&WC()->cart ) {119 if ( WC()->cart ) { 116 120 WC()->cart->maybe_set_cart_cookies(); 117 121 WC()->session->set( STAN_SESSION_USER_ID, get_current_user_id() ); 118 122 119 save_session( esc_html( sanitize_text_field( $ _COOKIE[ STAN_SESSION_ID_COOKIE ]) ) );123 save_session( esc_html( sanitize_text_field( $stan_session_id ) ) ); 120 124 } 121 125
Note: See TracChangeset
for help on using the changeset viewer.