CCCPaste

redirect user after checkout post package pro...

add_filter(
	'woocommerce_get_return_url',
	function ( $return_url, $order ) {
		if ( ! $order instanceof WC_Order ) {
			return $return_url;
		}
		if ( ! $order->has_status( array( 'processing', 'completed', 'on-hold' ) ) ) {
			return $return_url;
		}

		$redirect_url = home_url( '/account/edit-account/' );
		$target_slug  = 'post_package';
		$match        = false;

		foreach ( $order->get_items() as $item ) {
			$product = $item->get_product();
			if ( ! $product ) {
				continue;
			}
			if ( $product->get_type() === $target_slug ) {
				$match = true;
				break;
			}
		}

		return $match ? $redirect_url : $return_url;
	},
	10,
	2
);