I have recently had my site tallshipsnetwork.com migrated to a new server, at which point I am experiencing an issue with the Woo Buy or Select shortcode - it allows some products to be added to cart, but not others
Here's adding the links for you to view the issue yourself when testing:
The shortcode is added in the Content Template 'Product for a Trip'
The Products are displayed on a Trip CPT Page (Content Template 'Single Trip') through the view 'Products for a Trip'.
If you go to hidden link you'll see two products that are successfully being added to the cart when clicking 'Provisionally Book'.
If you go to hidden link you'll see the Product that are not being added to the cart when clicking 'Request Application/s'.
Beside each of the product names you'll see an 'Edit' link beside the Product Names so you can quickly access them in wp-admin to check stock etc.
I have tried the following:
- Removing the '/' from the shortcode text output
- removing the conditionals and displaying the shortcode only once in the content template
All of the above was working correctly pre-migration.
I tried to understand the origin of this issue to no avail. It seems that you have some custom logic defined in your theme. And I could not find what would integrate with WooCommerce add-to-cart process.
In fact, if you switch to the TwentyTwenty theme, the problem does not persist. And I was able to add the product to the cart and be redirected to the cart page.
Investigating custom code is out of the scope of our support forum https://toolset.com/toolset-support-policy/
I'll suggest reaching to the developer of your theme and asking for assistance. We'll remain at your service if you find a bug on the Toolset plugins.
Thank you for taking a look - after your response I investigated my validation code snippets once again and found the issue preventing add to cart (in some circumstances, the $passed variable was not returned on woocommerce_add_to_cart_validation).
However, I still have an issue whereby the woo-buy-or-select button doesn't output the quantity selector despite the show_quantity_in_button being set to 'yes'.
I just tried on my test site and I was not able to add the quantity selector. Let me check again on a clean install rather than mine which includes 3rd party plugins and themes.
If it is a general bug, I'll escalate it to our developers for another evaluation and will let you know.
As of now, the workaround that you shared works for me too.