Ramon Ahnert
Forum Replies Created
-
Forum: Plugins
In reply to: [Require Login for WooCommerce] Redirect to page NOT saving settingHi @dpiffy
I’m glad that you were able to fix the issue. Also, you can use the filter
wflu_redirect_after_login_page_urlto bypass the setting and add custom logic.Forum: Plugins
In reply to: [Require Login for WooCommerce] Redirect to a previus URLI think it’s because the default WP login page uses the parameter
redirect_to(note that I useredirect-toin the code snippet above) to redirect and remove other arguments in the URL.
Maybe you can try to useredirect_toto perform the redirect.Forum: Plugins
In reply to: [Require Login for WooCommerce] Redirect to a previus URLHi @zewa
Yes. You can pass the previous link as a query argument in the URL by using the filters
wflu_redirect_page_urlandwflu_redirect_after_login_page_url. Example:add_filter( 'wflu_redirect_page_url', function( $redirect_page ) { $link = get_permalink(); $redirect_page = add_query_arg( array( 'redirect-to' => $link, ), $redirect_page ); return $redirect_page; }, 10 ); add_filter( 'wflu_redirect_after_login_page_url', function( $redirect_to ) { if ( empty( $_GET['redirect-to'] ) ) { return $redirect_to; } $redirect_to_arg = esc_url( wp_unslash( $_GET['redirect-to'] ) ); if ( empty( $redirect_to_arg ) ) { return $redirect_to; } $redirect_to = $redirect_to_arg; return $redirect_to; }, 10 );Forum: Plugins
In reply to: [Require Login for WooCommerce] Private & Public StoreYes, you can use the filter
wflu_should_redirect_not_logged_in_userto implement your custom logic. Example:<?php add_filter( 'wflu_should_redirect_not_logged_in_user', function( $should_redirect_not_logged_in_user ) { return is_product_category( 'YOUR_CATEGORY' ) || $should_redirect_not_logged_in_user; } );References:
Forum: Plugins
In reply to: [Require Login for WooCommerce] Problem with new page nested under /shop/Hi @luca_2387
You can use the filter
wflu_should_redirect_not_logged_in_userto implement your custom logic to redirect the not logged-in user or not. Example:<?php add_filter( 'wflu_should_redirect_not_logged_in_user', function( $should_redirect_not_logged_in_user ) { return is_page( 'YOUR_PAGE' ) || $should_redirect_not_logged_in_user; } );References:
Forum: Plugins
In reply to: [Require Login for WooCommerce] Product page (templates) visible for guestsHi @pimonda1
Yes. You can add this code snippet to the functions.php file of your theme.
( No need to say sorry 🙂 )
Forum: Plugins
In reply to: [Require Login for WooCommerce] Product page (templates) visible for guestsHi @pimonda1
You can use the filter
wflu_should_redirect_not_logged_in_userto add custom logic to prevent redirecting when the user is trying to access the product page. Example:add_filter( 'wflu_should_redirect_not_logged_in_user', function( $should_redirect_not_logged_in_user ) { if ( is_product() ) { return false; } return $should_redirect_not_logged_in_user; } );Forum: Plugins
In reply to: [Require Login for WooCommerce] add an option to redirect to home pageHi @arcmax
Just to let you know you can use the filter
wflu_redirect_page_urlinstead of the code snippet above in version 1.3.0+.Forum: Plugins
In reply to: [Require Login for WooCommerce] Giving error on a configuration pageThe URL shouldn’t be the shop/cart/checkout page otherwise it will redirect in an infinite loop.
The plugin prevents that not logged-in users access the shop page and redirects to the “My Account” page by default to log in. This code snippet allows you to change this default page but you can’t redirect to the shop/cart/checkout page.
Forum: Plugins
In reply to: [Require Login for WooCommerce] Giving error on a configuration pageWhat URL you’re using in the code snippet?
Forum: Plugins
In reply to: [Require Login for WooCommerce] Giving error on a configuration pageBased on the log, it seems that the issue could be caused by Divi. However, it’s hard to say without debugging properly. You can disable Divi to check if the configuration page works.
Also, you can set up the redirect page URL using the filter
wflu_redirect_page_urlby adding the code snippet below to the functions.php file of your theme:add_filter( 'wflu_redirect_page_url', function() { return 'http://YOURURL.com/'; } );Forum: Plugins
In reply to: [Require Login for WooCommerce] Giving error on a configuration pageThe error is happening when the plugin tries to retrieve the pages in the endpoint
/wp-json/wp/v2/pages?per_page=5(WP API REST) and since it is returning an error 500 it means that the error is happening on the server side. That way, you need to look at the server logs to get more information about the error. Once you do that, paste the log here.This article can give you some guidance: https://wordpress.org/support/article/debugging-in-wordpress/
Other than that, make sure you can access directly in the browser
YOURDOMAIN.com/wp-json/wp/v2/pages?per_page=5- This reply was modified 3 years, 10 months ago by Ramon Ahnert.
- This reply was modified 3 years, 10 months ago by Ramon Ahnert.
Forum: Plugins
In reply to: [Require Login for WooCommerce] Giving error on a configuration pageHi @kinsey95
Could you check if there is some error in the console of the browser (Developer tools)?
Other than that, is the WP REST API enabled on your site? You can check it by accessing the URL:
yourdomain.com/wp-json.Forum: Plugins
In reply to: [Require Login for WooCommerce] add an option to redirect to home pageHi @arcmax
If the home page is not appearing when you type to search in the field “Redirect to page” (WooCommerce -> WooCommerce for logged-in users), you can try the code snippet below.
It’s important to notice that the shop page should not be the home page. Otherwise, the code snippet will generate an infinite loop of redirections.
add_action( 'template_redirect', function() { if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ), true ) ) { if ( ! is_user_logged_in() && ( is_woocommerce() || is_cart() || is_checkout() ) ) { wp_safe_redirect( home_url() ); exit; } } }, 5 );Forum: Plugins
In reply to: [Require Login for WooCommerce] Plugin updateHi lorileti92.
I hope to update it soon 🙂
I’ve tested with the last WordPress (6.0.1) and WooCommerce (6.7.0) versions and it’s working as expected. So you can install the plugin with no worries.
Let me know if you find any issues.