Skip Navigation

[Resolved] [wpv-woo-buy-options] has undocumented attributes

This thread is resolved. Here is a description of the problem and solution.

Problem:
The Plugin WooCommerce Subscriptions, which we recommend in our tutorials for Membership Sites, registers 2 new Product Types: “subscriptions” and “variable-subscriptions”. These are technically “taxonomy terms”, in WooCommerce.

These Product Types will not work nicely with WooCommerce Views when you insert the “wpv-woo-buy-or-select” shortcode with “show_variation_options” set to “true”.

The issue is that it will not allow you to select any variations and you cannot add the product to the cart.

Solution:
https://toolset.com/errata/woocommerce-subscriptions-plugin-subscriptions-are-not-selectable-with-woocommerce-views/

This support ticket is created 6 years, 1 month 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 6 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#616482

Link to documentation page: https://toolset.com/documentation/user-guides/views-shortcodes/

I found this support thread: https://toolset.com/forums/topic/products-page-and-woocommerce-subscriptions-problem/ as I also had the same problem with the front end presentation of Woocommerce Variable Subscription products. In this thread Beda presents a solution using the [wpv-woo-buy-options] shortcode with several attributes:

add_to_cart_text="add to cart"
show_quantity_in_button="yes"
group_add_to_cart_text="Grouped"
show_variation_options="yes"

These attributes are currently not documented on the page https://toolset.com/documentation/user-guides/views-shortcodes/ while they are essential for the solution Beda offers. I can confirm I tried this solution and it works with the Toolset Starter theme, Woocommerce Views and the Woocommerce Subscription plugin to show a dropdown with the Subscription Variations on a single product page.

I would like to have a complete reference of all the attributes we can use with the various Views shortcodes. In this case it seems to me the documentation is incomplete. I would like to know the meaning and possibilities of the attributes Beda uses in his example code.

#616706

There seems to be some misunderstanding.

There are 2 ShortCodes, one for the Product Listing Pages and one for Single Products.
The one you refer to is [wpv-woo-buy-options] and supports exactly one attribute:
add_to_cart_text
It Displays 'add to cart' or 'select options' box for single product pages.

In the code this is as well visible in the wpv_woo_buy_options_func() function in Toolset WooCommerce Views in the file Class_WooCommerce_Views.php.

The other ShortCode [wpv-woo-buy-or-select] is created with wpv_woo_buy_or_select_func() in the same file and has all the attributes you mention.
It is used in loops instead of single posts.

The ShortCode there is wrong.

This are the right steps:

1. Install WooCommerce Subscriptions and a full Toolset WooCommerce Setup
2. Create a Variable Product as per WooCommerce native features
3. Create a Variable Subscriptions product
4. Create a Content Template for them and insert:
[wpv-woo-buy-options add_to_cart_text="Add to cart"]
5. You will see the Variations picker on the single products
6. Create an archive for the shop, and add this to the Loop:
[wpv-woo-buy-or-select show_variation_options="yes"]
7. Since the bug was not yet fixed, this last #6 now should show the same as the single product page, but does not:
https://toolset.com/errata/woocommerce-subscriptions-plugin-subscriptions-are-not-selectable-with-woocommerce-views/

Please await the fix in that erratum, or via update.

Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.