WC_Privacy::anonymize_completed_orders( int $limit = 20 )

Anonymize old completed orders.


Description Description


Parameters Parameters

$limit

(Optional) Limit orders to process per batch.

Default value: 20


Top ↑

Return Return

(int) Number of orders processed.


Top ↑

Source Source

File: includes/class-wc-privacy.php

	public static function anonymize_completed_orders( $limit = 20 ) {
		$option = wc_parse_relative_date_option( get_option( 'woocommerce_anonymize_completed_orders' ) );

		if ( empty( $option['number'] ) ) {
			return 0;
		}

		return self::anonymize_orders_query(
			apply_filters(
				'woocommerce_anonymize_completed_orders_query_args',
				array(
					'date_created' => '<' . strtotime( '-' . $option['number'] . ' ' . $option['unit'] ),
					'limit'        => $limit, // Batches of 20.
					'status'       => 'wc-completed',
					'anonymized'   => false,
					'type'         => 'shop_order',
				)
			)
		);
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.4.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.