PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.18
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.18
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
← All changes | includes/Form_Handler.php +31 -0 1.10.11.10.18 View file →
@@ -97,9 +97,40 @@
97 97 }
98 98
99 99 // set customer.
100 100 wp_set_current_user( $order->get_customer_id() );
101 +
102 + /*
103 + * The pay nonce was minted in Templates\Payment with the logged-out nonce
104 + * identity forced to 0 (its nonce_user_logged_out filter). That filter only
105 + * exists while the template renders — it is not registered on this POST,
106 + * which WooCommerce's own pay handler processes later on this same 'wp'
107 + * hook (priority 20). Without the mirror here, a guest-session cookie
108 + * (set by the pay page itself, and always replayed by the iOS/Android
109 + * WebViews) makes WC_Session_Handler resolve the logged-out identity to
110 + * its 't_…' customer id at verify time, the nonce hash no longer matches,
111 + * and WC_Form_Handler::pay_action() drops the payment silently.
112 + * Priority 20 so it wins over WC_Session_Handler's filter (priority 10).
113 + */
114 + add_filter( 'nonce_user_logged_out', array( $this, 'nonce_user_logged_out' ), 20, 2 );
101 115 }
116 + }
117 +
118 + /**
119 + * Force the logged-out nonce identity to 0 for the pay nonce, matching the
120 + * identity Templates\Payment mints it with.
121 + *
122 + * @param int|string $uid The logged-out nonce identity.
123 + * @param string|int $action The nonce action.
124 + *
125 + * @return int|string
126 + */
127 + public function nonce_user_logged_out( $uid, $action ) {
128 + if ( 'woocommerce-pay' === $action ) {
129 + return 0;
130 + }
131 +
132 + return $uid;
102 133 }
103 134
104 135 /**
105 136 * Process the coupon action.