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
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?
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?
Sure. I set your next reply as private to let you share login credentials safely. ** Make a database backup before sharing credentials. **
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".
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?
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.
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?
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.
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
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 🙂
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
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.
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