Skip Navigation

[Resolved] Making a page and product visible without sign in

This support ticket is created 4 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 13 replies, has 2 voices.

Last updated by lukeM-7 4 years, 3 months ago.

Assisted by: Jamal.

Author
Posts
#1717041

Hi,

We'd like this product to be able to be ordered without someone being a member of the site and being restricted by one of the membership plans. Although we have removed it from what we see fit, it still cannot be purchased.

hidden link

Can you explain how to make this product completely open for ordering? without being logged in

Thanks
Dan

#1717119

Hello Dan and thank you for contacting the Toolset support.

It seems as if the product has another status than "Published" or maybe its stock is empty. Try to check with a default theme if it will present the same issue?

Can you also deactivate all Toolset plugins and check if there are any differences?

#1717151

It would be hard to do either of those as its a live site, with no staging. If you allow me to share login details that might help if you look directly?

#1717187

Sure. I set your next reply as private to let you share login credentials safely. ** Make a database backup before sharing credentials. **

#1720755

The products are displayed using a Toolset layout(#37). The layout uses conditional shortcodes to display the add-to-cart button only to logged-in users. Check this screenshot hidden link
If you want guest users to be able to add the product to the cart, you will have to remove the condition on the current user:

[wpv-conditional if="( '[wpv-current-user]' ne '' )"]
      [wcm_restrict plans="member-standard"]
      [wpv-woo-buy-options add_to_cart_text='Add to basket']
      [/wcm_restrict]
      [wcm_nonmember plans="member-standard"]
      <p class="lead">To access resources please <a href="<em><u>hidden link</u></em>">join now</a>
      [/wcm_nonmember]
      [/wpv-conditional]

You may also want to remove the restrictions by plans wcm_restrict plans="member-standard".

#1720859

Ok, the issue is that other products need to remain restricted its not one size fits all. Is it not possible to avoid using TS templates just for one item, so it can remain open? Or make the above change on a product only basis?

#1721629

You can create a different layout that does not have the restriction on guest users and assign it to this specific product. This assignment can't be done from the interface, it will need a custom code to be implemented. Check this sample code:

function apply_layout_for_specific_posts( $id, $layout ){
	global $post;
	
	if(!is_singular('product')) return $id; 
	
	$unrestricted_layout = 111;
	$unrestricted_products = array(222);
	
	if ( in_array( $unrestricted_products, $post->ID ) {
		return $unrestricted_layout;
	}
	
	return $id;
} 
add_filter('get_layout_id_for_render', 'apply_layout_for_specific_posts', 10, 2);

Change line 5 and put the new(unrestricted) layout ID instead of "111".
Change line 6 and put the ID(s) of the product(s) that you want to make available for guests.

Let me know if you need assistance with implementing this solution.

#1745141

Thanks, we need some furthe rhelp though, its out of skill set for us to do this. Is there anyway we can have your help in creating this for us please?

#1763547

Hello! My colleague Christian has reopened this ticket and told me about it. I'll do my best to help.

The solution is pretty easy and I'll walk you through it.

First, you will need to create a different layout to display this specific post. You can start by duplicating the existing layout, then edit it to remove the restriction on logged in users. Then you will have to note the ID of this layout from the URL of the editing page.
I duplicated it to layout with ID 777656, but it seems that it was changed since my last update.

Then, add the suggested code to Toolset->Settings->Custom Code, and activate it to run for the frontend and AJAX calls. No need to activate it for the backend requests. Check this screenshot hidden link
You will have to change this code to reflect your website data. In line 6, put the ID of the new layout that you have created. And in line 7, put the ID of the product that you want it to be used on(748500 ).

// Put the code of your snippet below this comment.
function apply_layout_for_specific_posts( $id, $layout ){
    global $post;
     
    if(!is_singular('product')) return $id; 
     
    $unrestricted_layout = 777656;
    $unrestricted_products = array(748500);
     
    if ( in_array( $unrestricted_products, $post->ID ) ) {
        return $unrestricted_layout;
    }
     
    return $id;
} 
add_filter('get_layout_id_for_render', 'apply_layout_for_specific_posts', 10, 2);

Check the results here hidden link

I hope that's what you are looking for, let me know if I missed something.

#1767857

Thanks for responding, sorry just a little unclear to what you have done and I need to do. The link below does not show the buy now button currently. Are you saying I need to make the above changes you provided to the page? This is so out our comfort zone, if you could actually do the change we would be very grateful....

Thank you

#1769105

I already did these changes, I just shared them for reference.

But, as I have explained, I think that the original layout, was changed in the previous weeks and I was not sure anymore about what would you need to display for that product.

I understand that's not easier for you, and I'll help with it. But I need to get a clear understanding of what is the expected result. Can you record a short video, or take a screenshot that explains what buttons should appear and what should not appear compared to other products. I am sure you will understand, that we, supporters, can't remember each client's website context 🙂

#1770145
Untitled-2.jpg

Thanks for what you have done. What is missing is:
- When I goto hidden link
- It should be possible to Buy Now, using the standard woo button
- I should not ned to login for this, it should just add to the cart and then let me check out

See the image below, does that help?

Dan

#1770775

Hello Dan,

It seems that the issue is not from the layout or the content template. Instead, it is caused by a restriction on the product. Check this screenshot hidden link
I could not verify this, by removing the restriction, because I do not want to update your business data. Can you do it and test? Or make a database backup and let me test it from my end.

#1776793

My issue is resolved now. Thank you! I saw against the product there is an option to force the item to always be visiable, i selected this and problem solved. Many thanks