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3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / class-wc-privacy.php
woocommerce / includes Last commit date
abstracts 2 years ago admin 2 years ago blocks 5 years ago cli 3 years ago customizer 3 years ago data-stores 2 years ago emails 2 years ago export 2 years ago gateways 2 years ago import 3 years ago integrations 4 years ago interfaces 3 years ago legacy 2 years ago libraries 3 years ago log-handlers 4 years ago payment-tokens 5 years ago queue 4 years ago react-admin 2 years ago rest-api 3 years ago shipping 2 years ago shortcodes 2 years ago theme-support 3 years ago tracks 2 years ago traits 5 years ago walkers 5 years ago wccom-site 2 years ago widgets 3 years ago class-wc-ajax.php 2 years ago class-wc-api.php 4 years ago class-wc-auth.php 4 years ago class-wc-autoloader.php 5 years ago class-wc-background-emailer.php 5 years ago class-wc-background-updater.php 5 years ago class-wc-breadcrumb.php 5 years ago class-wc-cache-helper.php 3 years ago class-wc-cart-fees.php 5 years ago class-wc-cart-session.php 3 years ago class-wc-cart-totals.php 2 years ago class-wc-cart.php 3 years ago class-wc-checkout.php 3 years ago class-wc-cli.php 3 years ago class-wc-comments.php 3 years ago class-wc-countries.php 2 years ago class-wc-coupon.php 3 years ago class-wc-customer-download-log.php 5 years ago class-wc-customer-download.php 4 years ago class-wc-customer.php 3 years ago class-wc-data-exception.php 8 years ago class-wc-data-store.php 3 years ago class-wc-datetime.php 4 years ago class-wc-deprecated-action-hooks.php 8 years ago class-wc-deprecated-filter-hooks.php 3 years ago class-wc-discounts.php 3 years ago class-wc-download-handler.php 3 years ago class-wc-emails.php 3 years ago class-wc-embed.php 5 years ago class-wc-form-handler.php 3 years ago class-wc-frontend-scripts.php 3 years ago class-wc-geo-ip.php 4 years ago class-wc-geolite-integration.php 6 years ago class-wc-geolocation.php 3 years ago class-wc-https.php 2 years ago class-wc-install.php 3 years ago class-wc-integrations.php 5 years ago class-wc-log-levels.php 5 years ago class-wc-logger.php 4 years ago class-wc-meta-data.php 4 years ago class-wc-order-factory.php 3 years ago class-wc-order-item-coupon.php 4 years ago class-wc-order-item-fee.php 4 years ago class-wc-order-item-meta.php 4 years ago class-wc-order-item-product.php 4 years ago class-wc-order-item-shipping.php 4 years ago class-wc-order-item-tax.php 4 years ago class-wc-order-item.php 4 years ago class-wc-order-query.php 4 years ago class-wc-order-refund.php 3 years ago class-wc-order.php 2 years ago class-wc-payment-gateways.php 4 years ago class-wc-payment-tokens.php 3 years ago class-wc-post-data.php 3 years ago class-wc-post-types.php 3 years ago class-wc-privacy-background-process.php 5 years ago class-wc-privacy-erasers.php 4 years ago class-wc-privacy-exporters.php 4 years ago class-wc-privacy.php 4 years ago class-wc-product-attribute.php 4 years ago class-wc-product-download.php 4 years ago class-wc-product-external.php 5 years ago class-wc-product-factory.php 5 years ago class-wc-product-grouped.php 8 years ago class-wc-product-query.php 5 years ago class-wc-product-simple.php 3 years ago class-wc-product-variable.php 3 years ago class-wc-product-variation.php 4 years ago class-wc-query.php 3 years ago class-wc-rate-limiter.php 4 years ago class-wc-regenerate-images-request.php 3 years ago class-wc-regenerate-images.php 3 years ago class-wc-register-wp-admin-settings.php 4 years ago class-wc-rest-authentication.php 3 years ago class-wc-rest-exception.php 5 years ago class-wc-session-handler.php 2 years ago class-wc-shipping-rate.php 3 years ago class-wc-shipping-zone.php 5 years ago class-wc-shipping-zones.php 5 years ago class-wc-shipping.php 4 years ago class-wc-shortcodes.php 5 years ago class-wc-structured-data.php 3 years ago class-wc-tax.php 2 years ago class-wc-template-loader.php 3 years ago class-wc-tracker.php 2 years ago class-wc-validation.php 3 years ago class-wc-webhook.php 3 years ago class-woocommerce.php 2 years ago wc-account-functions.php 3 years ago wc-attribute-functions.php 3 years ago wc-cart-functions.php 3 years ago wc-conditional-functions.php 3 years ago wc-core-functions.php 3 years ago wc-coupon-functions.php 3 years ago wc-deprecated-functions.php 3 years ago wc-formatting-functions.php 2 years ago wc-notice-functions.php 3 years ago wc-order-functions.php 3 years ago wc-order-item-functions.php 3 years ago wc-page-functions.php 2 years ago wc-product-functions.php 3 years ago wc-rest-functions.php 3 years ago wc-stock-functions.php 3 years ago wc-template-functions.php 2 years ago wc-template-hooks.php 5 years ago wc-term-functions.php 3 years ago wc-update-functions.php 3 years ago wc-user-functions.php 2 years ago wc-webhook-functions.php 4 years ago wc-widget-functions.php 5 years ago
class-wc-privacy.php
394 lines
1 <?php
2 /**
3 * Privacy/GDPR related functionality which ties into WordPress functionality.
4 *
5 * @since 3.4.0
6 * @package WooCommerce\Classes
7 */
8
9 defined( 'ABSPATH' ) || exit;
10
11 if ( ! class_exists( 'WC_Privacy_Background_Process', false ) ) {
12 include_once __DIR__ . '/class-wc-privacy-background-process.php';
13 }
14
15 /**
16 * WC_Privacy Class.
17 */
18 class WC_Privacy extends WC_Abstract_Privacy {
19
20 /**
21 * Background process to clean up orders.
22 *
23 * @var WC_Privacy_Background_Process
24 */
25 protected static $background_process;
26
27 /**
28 * Init - hook into events.
29 */
30 public function __construct() {
31 parent::__construct();
32
33 // Initialize data exporters and erasers.
34 add_action( 'plugins_loaded', array( $this, 'register_erasers_exporters' ) );
35
36 // Cleanup orders daily - this is a callback on a daily cron event.
37 add_action( 'woocommerce_cleanup_personal_data', array( $this, 'queue_cleanup_personal_data' ) );
38
39 // Handles custom anonymization types not included in core.
40 add_filter( 'wp_privacy_anonymize_data', array( $this, 'anonymize_custom_data_types' ), 10, 3 );
41
42 // When this is fired, data is removed in a given order. Called from bulk actions.
43 add_action( 'woocommerce_remove_order_personal_data', array( 'WC_Privacy_Erasers', 'remove_order_personal_data' ) );
44 }
45
46 /**
47 * Initial registration of privacy erasers and exporters.
48 *
49 * Due to the use of translation functions, this should run only after plugins loaded.
50 */
51 public function register_erasers_exporters() {
52 $this->name = __( 'WooCommerce', 'woocommerce' );
53
54 if ( ! self::$background_process ) {
55 self::$background_process = new WC_Privacy_Background_Process();
56 }
57
58 // Include supporting classes.
59 include_once __DIR__ . '/class-wc-privacy-erasers.php';
60 include_once __DIR__ . '/class-wc-privacy-exporters.php';
61
62 // This hook registers WooCommerce data exporters.
63 $this->add_exporter( 'woocommerce-customer-data', __( 'WooCommerce Customer Data', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'customer_data_exporter' ) );
64 $this->add_exporter( 'woocommerce-customer-orders', __( 'WooCommerce Customer Orders', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'order_data_exporter' ) );
65 $this->add_exporter( 'woocommerce-customer-downloads', __( 'WooCommerce Customer Downloads', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'download_data_exporter' ) );
66 $this->add_exporter( 'woocommerce-customer-tokens', __( 'WooCommerce Customer Payment Tokens', 'woocommerce' ), array( 'WC_Privacy_Exporters', 'customer_tokens_exporter' ) );
67
68 // This hook registers WooCommerce data erasers.
69 $this->add_eraser( 'woocommerce-customer-data', __( 'WooCommerce Customer Data', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'customer_data_eraser' ) );
70 $this->add_eraser( 'woocommerce-customer-orders', __( 'WooCommerce Customer Orders', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'order_data_eraser' ) );
71 $this->add_eraser( 'woocommerce-customer-downloads', __( 'WooCommerce Customer Downloads', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'download_data_eraser' ) );
72 $this->add_eraser( 'woocommerce-customer-tokens', __( 'WooCommerce Customer Payment Tokens', 'woocommerce' ), array( 'WC_Privacy_Erasers', 'customer_tokens_eraser' ) );
73 }
74
75 /**
76 * Add privacy policy content for the privacy policy page.
77 *
78 * @since 3.4.0
79 */
80 public function get_privacy_message() {
81 $content = '<div class="wp-suggested-text">' .
82 '<p class="privacy-policy-tutorial">' .
83 __( 'This sample language includes the basics around what personal data your store may be collecting, storing and sharing, as well as who may have access to that data. Depending on what settings are enabled and which additional plugins are used, the specific information shared by your store will vary. We recommend consulting with a lawyer when deciding what information to disclose on your privacy policy.', 'woocommerce' ) .
84 '</p>' .
85 '<p>' . __( 'We collect information about you during the checkout process on our store.', 'woocommerce' ) . '</p>' .
86 '<h2>' . __( 'What we collect and store', 'woocommerce' ) . '</h2>' .
87 '<p>' . __( 'While you visit our site, we’ll track:', 'woocommerce' ) . '</p>' .
88 '<ul>' .
89 '<li>' . __( 'Products you’ve viewed: we’ll use this to, for example, show you products you’ve recently viewed', 'woocommerce' ) . '</li>' .
90 '<li>' . __( 'Location, IP address and browser type: we’ll use this for purposes like estimating taxes and shipping', 'woocommerce' ) . '</li>' .
91 '<li>' . __( 'Shipping address: we’ll ask you to enter this so we can, for instance, estimate shipping before you place an order, and send you the order!', 'woocommerce' ) . '</li>' .
92 '</ul>' .
93 '<p>' . __( 'We’ll also use cookies to keep track of cart contents while you’re browsing our site.', 'woocommerce' ) . '</p>' .
94 '<p class="privacy-policy-tutorial">' .
95 __( 'Note: you may want to further detail your cookie policy, and link to that section from here.', 'woocommerce' ) .
96 '</p>' .
97 '<p>' . __( 'When you purchase from us, we’ll ask you to provide information including your name, billing address, shipping address, email address, phone number, credit card/payment details and optional account information like username and password. We’ll use this information for purposes, such as, to:', 'woocommerce' ) . '</p>' .
98 '<ul>' .
99 '<li>' . __( 'Send you information about your account and order', 'woocommerce' ) . '</li>' .
100 '<li>' . __( 'Respond to your requests, including refunds and complaints', 'woocommerce' ) . '</li>' .
101 '<li>' . __( 'Process payments and prevent fraud', 'woocommerce' ) . '</li>' .
102 '<li>' . __( 'Set up your account for our store', 'woocommerce' ) . '</li>' .
103 '<li>' . __( 'Comply with any legal obligations we have, such as calculating taxes', 'woocommerce' ) . '</li>' .
104 '<li>' . __( 'Improve our store offerings', 'woocommerce' ) . '</li>' .
105 '<li>' . __( 'Send you marketing messages, if you choose to receive them', 'woocommerce' ) . '</li>' .
106 '</ul>' .
107 '<p>' . __( 'If you create an account, we will store your name, address, email and phone number, which will be used to populate the checkout for future orders.', 'woocommerce' ) . '</p>' .
108 '<p>' . __( 'We generally store information about you for as long as we need the information for the purposes for which we collect and use it, and we are not legally required to continue to keep it. For example, we will store order information for XXX years for tax and accounting purposes. This includes your name, email address and billing and shipping addresses.', 'woocommerce' ) . '</p>' .
109 '<p>' . __( 'We will also store comments or reviews, if you choose to leave them.', 'woocommerce' ) . '</p>' .
110 '<h2>' . __( 'Who on our team has access', 'woocommerce' ) . '</h2>' .
111 '<p>' . __( 'Members of our team have access to the information you provide us. For example, both Administrators and Shop Managers can access:', 'woocommerce' ) . '</p>' .
112 '<ul>' .
113 '<li>' . __( 'Order information like what was purchased, when it was purchased and where it should be sent, and', 'woocommerce' ) . '</li>' .
114 '<li>' . __( 'Customer information like your name, email address, and billing and shipping information.', 'woocommerce' ) . '</li>' .
115 '</ul>' .
116 '<p>' . __( 'Our team members have access to this information to help fulfill orders, process refunds and support you.', 'woocommerce' ) . '</p>' .
117 '<h2>' . __( 'What we share with others', 'woocommerce' ) . '</h2>' .
118 '<p class="privacy-policy-tutorial">' .
119 __( 'In this section you should list who you’re sharing data with, and for what purpose. This could include, but may not be limited to, analytics, marketing, payment gateways, shipping providers, and third party embeds.', 'woocommerce' ) .
120 '</p>' .
121 '<p>' . __( 'We share information with third parties who help us provide our orders and store services to you; for example --', 'woocommerce' ) . '</p>' .
122 '<h3>' . __( 'Payments', 'woocommerce' ) . '</h3>' .
123 '<p class="privacy-policy-tutorial">' .
124 __( 'In this subsection you should list which third party payment processors you’re using to take payments on your store since these may handle customer data. We’ve included PayPal as an example, but you should remove this if you’re not using PayPal.', 'woocommerce' ) .
125 '</p>' .
126 '<p>' . __( 'We accept payments through PayPal. When processing payments, some of your data will be passed to PayPal, including information required to process or support the payment, such as the purchase total and billing information.', 'woocommerce' ) . '</p>' .
127 '<p>' . __( 'Please see the <a href="https://www.paypal.com/us/webapps/mpp/ua/privacy-full">PayPal Privacy Policy</a> for more details.', 'woocommerce' ) . '</p>' .
128 '</div>';
129
130 return apply_filters( 'wc_privacy_policy_content', $content );
131 }
132
133 /**
134 * Spawn events for order cleanup.
135 */
136 public function queue_cleanup_personal_data() {
137 self::$background_process->push_to_queue( array( 'task' => 'trash_pending_orders' ) );
138 self::$background_process->push_to_queue( array( 'task' => 'trash_failed_orders' ) );
139 self::$background_process->push_to_queue( array( 'task' => 'trash_cancelled_orders' ) );
140 self::$background_process->push_to_queue( array( 'task' => 'anonymize_completed_orders' ) );
141 self::$background_process->push_to_queue( array( 'task' => 'delete_inactive_accounts' ) );
142 self::$background_process->save()->dispatch();
143 }
144
145 /**
146 * Handle some custom types of data and anonymize them.
147 *
148 * @param string $anonymous Anonymized string.
149 * @param string $type Type of data.
150 * @param string $data The data being anonymized.
151 * @return string Anonymized string.
152 */
153 public function anonymize_custom_data_types( $anonymous, $type, $data ) {
154 switch ( $type ) {
155 case 'address_state':
156 case 'address_country':
157 $anonymous = ''; // Empty string - we don't want to store anything after removal.
158 break;
159 case 'phone':
160 $anonymous = preg_replace( '/\d/u', '0', $data );
161 break;
162 case 'numeric_id':
163 $anonymous = 0;
164 break;
165 }
166 return $anonymous;
167 }
168
169 /**
170 * Find and trash old orders.
171 *
172 * @since 3.4.0
173 * @param int $limit Limit orders to process per batch.
174 * @return int Number of orders processed.
175 */
176 public static function trash_pending_orders( $limit = 20 ) {
177 $option = wc_parse_relative_date_option( get_option( 'woocommerce_trash_pending_orders' ) );
178
179 if ( empty( $option['number'] ) ) {
180 return 0;
181 }
182
183 return self::trash_orders_query(
184 apply_filters(
185 'woocommerce_trash_pending_orders_query_args',
186 array(
187 'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
188 'limit' => $limit, // Batches of 20.
189 'status' => 'wc-pending',
190 'type' => 'shop_order',
191 )
192 )
193 );
194 }
195
196 /**
197 * Find and trash old orders.
198 *
199 * @since 3.4.0
200 * @param int $limit Limit orders to process per batch.
201 * @return int Number of orders processed.
202 */
203 public static function trash_failed_orders( $limit = 20 ) {
204 $option = wc_parse_relative_date_option( get_option( 'woocommerce_trash_failed_orders' ) );
205
206 if ( empty( $option['number'] ) ) {
207 return 0;
208 }
209
210 return self::trash_orders_query(
211 apply_filters(
212 'woocommerce_trash_failed_orders_query_args',
213 array(
214 'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
215 'limit' => $limit, // Batches of 20.
216 'status' => 'wc-failed',
217 'type' => 'shop_order',
218 )
219 )
220 );
221 }
222
223 /**
224 * Find and trash old orders.
225 *
226 * @since 3.4.0
227 * @param int $limit Limit orders to process per batch.
228 * @return int Number of orders processed.
229 */
230 public static function trash_cancelled_orders( $limit = 20 ) {
231 $option = wc_parse_relative_date_option( get_option( 'woocommerce_trash_cancelled_orders' ) );
232
233 if ( empty( $option['number'] ) ) {
234 return 0;
235 }
236
237 return self::trash_orders_query(
238 apply_filters(
239 'woocommerce_trash_cancelled_orders_query_args',
240 array(
241 'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
242 'limit' => $limit, // Batches of 20.
243 'status' => 'wc-cancelled',
244 'type' => 'shop_order',
245 )
246 )
247 );
248 }
249
250 /**
251 * For a given query trash all matches.
252 *
253 * @since 3.4.0
254 * @param array $query Query array to pass to wc_get_orders().
255 * @return int Count of orders that were trashed.
256 */
257 protected static function trash_orders_query( $query ) {
258 $orders = wc_get_orders( $query );
259 $count = 0;
260
261 if ( $orders ) {
262 foreach ( $orders as $order ) {
263 $order->delete( false );
264 $count ++;
265 }
266 }
267
268 return $count;
269 }
270
271 /**
272 * Anonymize old completed orders.
273 *
274 * @since 3.4.0
275 * @param int $limit Limit orders to process per batch.
276 * @return int Number of orders processed.
277 */
278 public static function anonymize_completed_orders( $limit = 20 ) {
279 $option = wc_parse_relative_date_option( get_option( 'woocommerce_anonymize_completed_orders' ) );
280
281 if ( empty( $option['number'] ) ) {
282 return 0;
283 }
284
285 return self::anonymize_orders_query(
286 apply_filters(
287 'woocommerce_anonymize_completed_orders_query_args',
288 array(
289 'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
290 'limit' => $limit, // Batches of 20.
291 'status' => 'wc-completed',
292 'anonymized' => false,
293 'type' => 'shop_order',
294 )
295 )
296 );
297 }
298
299 /**
300 * For a given query, anonymize all matches.
301 *
302 * @since 3.4.0
303 * @param array $query Query array to pass to wc_get_orders().
304 * @return int Count of orders that were anonymized.
305 */
306 protected static function anonymize_orders_query( $query ) {
307 $orders = wc_get_orders( $query );
308 $count = 0;
309
310 if ( $orders ) {
311 foreach ( $orders as $order ) {
312 WC_Privacy_Erasers::remove_order_personal_data( $order );
313 $count ++;
314 }
315 }
316
317 return $count;
318 }
319
320 /**
321 * Delete inactive accounts.
322 *
323 * @since 3.4.0
324 * @param int $limit Limit users to process per batch.
325 * @return int Number of users processed.
326 */
327 public static function delete_inactive_accounts( $limit = 20 ) {
328 $option = wc_parse_relative_date_option( get_option( 'woocommerce_delete_inactive_accounts' ) );
329
330 if ( empty( $option['number'] ) ) {
331 return 0;
332 }
333
334 return self::delete_inactive_accounts_query( strtotime( '-' . $option['number'] . ' ' . $option['unit'] ), $limit );
335 }
336
337 /**
338 * Delete inactive accounts.
339 *
340 * @since 3.4.0
341 * @param int $timestamp Timestamp to delete customers before.
342 * @param int $limit Limit number of users to delete per run.
343 * @return int Count of customers that were deleted.
344 */
345 protected static function delete_inactive_accounts_query( $timestamp, $limit = 20 ) {
346 $count = 0;
347 $user_query = new WP_User_Query(
348 array(
349 'fields' => 'ID',
350 'number' => $limit,
351 'role__in' => apply_filters(
352 'woocommerce_delete_inactive_account_roles',
353 array(
354 'Customer',
355 'Subscriber',
356 )
357 ),
358 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
359 'relation' => 'AND',
360 array(
361 'key' => 'wc_last_active',
362 'value' => (string) $timestamp,
363 'compare' => '<',
364 'type' => 'NUMERIC',
365 ),
366 array(
367 'key' => 'wc_last_active',
368 'value' => '0',
369 'compare' => '>',
370 'type' => 'NUMERIC',
371 ),
372 ),
373 )
374 );
375
376 $user_ids = $user_query->get_results();
377
378 if ( $user_ids ) {
379 if ( ! function_exists( 'wp_delete_user' ) ) {
380 require_once ABSPATH . 'wp-admin/includes/user.php';
381 }
382
383 foreach ( $user_ids as $user_id ) {
384 wp_delete_user( $user_id );
385 $count ++;
386 }
387 }
388
389 return $count;
390 }
391 }
392
393 new WC_Privacy();
394