Skip Navigation

[Resolved] [wpv-woo-buy-options] does not work for all product types

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

Problem:
What is the ShortCode "wpv-woo-buy-options" for?

Solution:
The ShortCode "wpv-woo-buy-options" outputs the "Add to cart button" on the Product detail pages for simple products.
For Variable products, a user will be presented with a drop-down menu of Variations to select from. For other product types, the shortcode output will adjust automatically to the correct Add to cart button output

Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-woo-buy-or-select
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-woo-product-price

This support ticket is created 6 years, 10 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
- - 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)

Tagged: 

This topic contains 5 replies, has 3 voices.

Last updated by Pat 6 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#612783

Pat

Hello,

I'm currently working on an e-commerce site and face a strange situation.
I have created a product Views to display single product and have inserted the [wpv-woo-buy-options] shortcode.

I have found 2 situations where this shortcode does not return any price :
1. When used with a variable product with all variations having the same price.
2. When used with a single product

The first case can be treated with the following code inside the function.php :

function ssp_always_show_variation_prices($show, $parent, $variation) {
return true;
}
add_filter( 'woocommerce_show_variation_price', 'ssp_always_show_variation_prices', 99, 3);

For the second, currently, my only turnaround is to define only variable products, even if only one variation.

Let me know
Regards
Pat

#612976

Hi Pat, the wpv-woo-buy-options shortcode is only intended for use in the context of a single product post. It's not intended for use in a View. Here's the information from our documentation about the wpv-woo-buy-options shortcode:

This shortcode outputs the Add to cart button on the Product detail pages for simple products. For Variable products, a user will be presented with a drop-down menu of Variations to select from. For other product types, the shortcode output will adjust automatically to the correct Add to cart button output...

Two other shortcodes are available for use in a Product View: wpv-woo-buy-or-select and wpv-woo-product-price. More information about those here:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-woo-buy-or-select
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-woo-product-price

#612983

Pat

Hi Christian and thanks for your answer,

I was aware of the other shortcodes, but to me, there is an issue as you can have different types of products (simple, variable) and also, some of them could have the same variation price !

So, if I need to built a Views able to treat all these products types, then, I should use a shortcode for variable, another one for simple and then, the issue with the variable using the same variation price is still there !!!

I know I can use the product price shortcode, but for variable products, this means 2 times the price info !!!

My recommendation would be to have a specific mecanism inside the [wpv-woo-buy-options] shortcode that could prevent this kind of issue?

Would be good to transfer this to your development team in order to see if something is feasible.

Regards
Pat

#613008

Okay I will reassign this ticket to Beda, who reviews all feature requests for Views and WooCommerce Views. He will analyze the information and follow up with you soon. Thanks for the report!

#613286

Hello Pat.

You might check upon the product type.
hidden link

Return that in a Custom Function or ShortCode, and use it in a Conditional HTML:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

I will file the feature request but cannot grant this will be implemented any time soon.

WooCommerce Views will be receiving development only after the current many to many development processes.

#613339

Pat

Hi Beda,

Thanks for your info.

I'm OK to leave like this for the moment. We'll see what the developpers could propose for the future.
Regards
Pat