WC_Product_Usage_Notice::ajax_remind_later()public staticWC 1.0

AJAX handler for "remind later" action of product usage notice.

Method of the class: WC_Product_Usage_Notice{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Product_Usage_Notice::ajax_remind_later();

WC_Product_Usage_Notice::ajax_remind_later() code WC 9.5.1

public static function ajax_remind_later() {
	if ( ! check_ajax_referer( 'remind_later_product_usage_notice' ) ) {
		wp_die( -1 );
	}

	$user_id = get_current_user_id();
	if ( ! $user_id ) {
		wp_die( -1 );
	}

	$product_id = absint( $_GET['product_id'] ?? 0 );
	if ( ! $product_id ) {
		wp_die( -1 );
	}

	update_user_meta( $user_id, self::REMIND_LATER_TIMESTAMP_META_PREFIX . $product_id, time() );

	wp_die( 1 );
}