Automattic\WooCommerce\Internal
DownloadPermissionsAdjuster::maybe_schedule_adjust_download_permissions()
Schedule a download permissions adjustment for a product if necessary. This should be executed whenever a product is saved.
Метод класса: DownloadPermissionsAdjuster{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$DownloadPermissionsAdjuster = new DownloadPermissionsAdjuster(); $DownloadPermissionsAdjuster->maybe_schedule_adjust_download_permissions( $product );
- $product(\WC_Product) (обязательный)
- The product to schedule a download permission adjustments for.
Код DownloadPermissionsAdjuster::maybe_schedule_adjust_download_permissions() DownloadPermissionsAdjuster::maybe schedule adjust download permissions WC 7.3.0
public function maybe_schedule_adjust_download_permissions( \WC_Product $product ) { $children_ids = $product->get_children(); if ( ! $children_ids ) { return; } $scheduled_action_args = array( $product->get_id() ); $already_scheduled_actions = WC()->call_function( 'as_get_scheduled_actions', array( 'hook' => 'adjust_download_permissions', 'args' => $scheduled_action_args, 'status' => \ActionScheduler_Store::STATUS_PENDING, ), 'ids' ); if ( empty( $already_scheduled_actions ) ) { WC()->call_function( 'as_schedule_single_action', WC()->call_function( 'time' ) + 1, 'adjust_download_permissions', $scheduled_action_args ); } }