Public Ticket #3490443

Elementor shop archive not hiding

Closed
Comments
8 Tickets 9
Dino started the conversation 3 years ago on October 2, 2023 at 10:50pm

so I created a custom listing grid with crocoblock jet engine as I always do, which is calling upon products post type. I can't figure out how to get this to be hidden like if I had use the default woocommerce short code for the shop grid. any help would be appreciated.

2,762
KingsPlugins replied 3 years ago on October 3, 2023 at 4:28pm

Hi Dino,

Thank you for purchasing our plugin,


Are you trying to hide specific products through B2BKing's product visibility feature? and these products are not being hidden in that crocoblock grid?

If so, please try enabling the setting in B2BKing -> Settings -> Other -> Product Visibility Cache: this helps set visibility at a deeper level.


Or are you trying to hide the grid in general using CSS? It would help if you can share more details, so we can better understand what you're trying to achieve,


Kind regards,

Stefan

8 Tickets 9
Dino replied 3 years ago on October 3, 2023 at 4:44pm

Hey Stefan thank for getting back to me quickly...

So basically im trying to have the store set up where if a user is not logged in (b2b only) that it redirects them to a custom login page. If I add elementor product archive or use default woocommerce shortcode for the product grid, it works as such where any page clicked redirects to the login page, but I assume because im using Crocoblock jet engine listing grid to call products, its not being registered the same way nor showing the login page. it is redirecting to the shop page on every other page click but just shows the product grid. so to answer your quesiton, im trying to hide all products unless otherwise logged in and redirect users to b2b login / signup page

8 Tickets 9
Dino replied 3 years ago on October 5, 2023 at 10:11pm

Hey Stefan,

This is great thank you for doing so. so should I not update the plugin if there is an update for it or will this be released in an upcoming version?

Last question, how would I change the redirect URL for the shop for users not signed in and not allowed to do anything but sign in, like I want the shop to be visible such as the setting Access Restriction > Restrict All Pages does, but it just reloads / redirects to the shop page. I would prefer it to redirect to a page of my choosing or even the My Account page. possible?

2,762
KingsPlugins replied 3 years ago on October 6, 2023 at 7:55am

This is great thank you for doing so. so should I not update the plugin if there is an update for it or will this be released in an upcoming version?

This will be added to the main codebase, so you will be able to update to all future plugin versions without losing the change. 


Last question, how would I change the redirect URL for the shop for users not signed in and not allowed to do anything but sign in, like I want the shop to be visible such as the setting Access Restriction > Restrict All Pages does, but it just reloads / redirects to the shop page. I would prefer it to redirect to a page of my choosing or even the My Account page. possible?

You can make it redirect to a different page, instead of the shop page, by adding this PHP code snippet to your site:

add_filter('b2bking_guest_shop_redirect_link', function($redirect_link){
    $redirect_link = get_permalink(wc_get_page_id('myaccount'));
}, 10, 1);

The above makes it redirect to the my account page, but you can specify any page there.



8 Tickets 9
Dino replied 3 years ago on October 6, 2023 at 3:45pm

it just goes blank when I click on any other page with that code implemented in snippets or in functions.php, any ideas?


goodnewsdistro.com

2,762
KingsPlugins replied 3 years ago on October 6, 2023 at 3:54pm

Ah, I apologise, I see now that code was not fully correct. 

(1) Please use the following code instead:

add_filter('b2bking_guest_shop_redirect_link', function($redirect_link){
    $redirect_link = get_permalink(wc_get_page_id('myaccount'));
    return $redirect_link;
}, 10, 1);

The above works for the my account page. It seems to work in my tests.


(2) If you want to use a different page, by ID, you can use this code:

add_filter('b2bking_guest_shop_redirect_link', function($redirect_link){
    $redirect_link = get_permalink(1234);
    return $redirect_link;
}, 10, 1);
add_filter('b2bking_guest_shop_redirect_conditional', function($redirect){
    if (get_queried_object_id() == 1234){
        $redirect = false;
    }
    return $redirect;
}, 10, 1);

1234 needs to be replaced with the ID of the page. The ID of the page can be seen in the URL when you edit the page (e.g. "?post=1234)

8 Tickets 9
Dino replied 3 years ago on October 6, 2023 at 4:06pm

its perfect! using the ID I like. last thing is it works on every page, except when I click back to shop it shows the blank shop instead of redirecting back to the page id specified.

2,762
KingsPlugins replied 3 years ago on October 7, 2023 at 10:04am

it works on every page, except when I click back to shop it shows the blank shop instead of redirecting back to the page id specified.

Here the code is pre-set so that 2 pages do not redirect to the specific ID: the shop page and the my account page.

That's because the shop page (and account page) would normally show the login and registration.

9677538604.png




I guess I am confused about why it's not showing the login on your site. I thought the previous update I shared would help achieve that.

Is it possible to share a backend login to your site, or a staging clone site with us? It would be great if I could check it directly, to see what is happening.

8 Tickets 9
Dino replied 3 years ago on October 11, 2023 at 1:21am

hey Stefan,

so ideally, I would also like that page to redirect to the newly added redirected page when na user is logged out. so since you helped me with redirecting to a specific page already (in my case user account), I would also like the shop to redirect the users to that page when logged out, rather than have a whole other login / registration form. make sense?

2,762
KingsPlugins replied 3 years ago on October 13, 2023 at 3:40am

Hi Dino,

I made another plugin update and added a code snippet to make the shop page also redirect.

I believe that's working now. 


Let me know if you see any issues.

Sign In