Skip Navigation

[Resolved] Add to cart woocommerce inside [wpv-conditional]

This support ticket is created 2 years, 4 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 4 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#1780767
Screenshot 2020-09-18 at 02.20.57.png

Tell us what you are trying to do?
Hi , I try to hide Add to cart button on product single page if no authorisations provided for user. I've been able to show button only with this strange combination of href short code. Unfortunately this code inside [wpv-conditional] shows 404 Error when I push the "Add to cart button" (please see the link - hidden link )
The address line in. browser looks like this - hidden link; ... so the only problem looks in '%20' which is actually ' ' in standart woocommerce shortcode [add to cart_url id=""]
Is there way to fix it (I mean what is the right syntax should be) inside the toolset conditions...

[code]
[wpv-conditional if="(( metadata_exists( post, [wpv-post-id], s2member_ccaps_req ) eq 1 ) AND ( '[wpv-current-user info='logged_in']' eq 'true' ) AND (current_user_can('access_s2member_ccap_[wpv-post-id]') eq 1 )) OR ( metadata_exists( post, [wpv-post-id], s2member_ccaps_req ) ne 1 )"]<div><a class="ui large primary button qck-click-btn-single" href="[add_to_cart_url%20id={!{wpv-post-id}!}]"><i class="fas fa-cart-plus"> Добавить</a></div>
[/wpv-conditional]
[/code]

P.s. switching to the [wpv-woo-buy-options] looks like options - button even didn't showing up on single page

#1781209

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

I have tried it in my localhost with a fresh WP installation + the latest version of Toolset plugin + Woocommerce plugin, it works fine, I can see the button in front-end, and the link works well too.

Please check these:
1) Make sure you are putting those codes in a pure text editor,
2) Make sure you are using the latest version of Toolset plugins, you can download them here:
https://toolset.com/account/downloads/
3) In case it is a compatibility problem, please deactivate all other plugins, and switch to wordpress default theme 2020, deactivate all custom PHP/JS code snippets, and test again