Skip Navigation

[Resolved] wpv-woo-buy-or-select not correctly displaying prices for variations

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

Problem: I'm using the wpv-woo-buy-or-select shortcode to display variable product add-to-cart buttons on a View of Products. However, sometimes the price doesn't appear for all variations. Usually it seems like I must set a sale price to see the price appear in the front-end.

Solution: It's actually because all the variations have the same price. This is how WooCommerce's add-to-cart feature works for variable products, as you can see on the single product page with Toolset deactivated. You can add the wpv-woo-product-price shortcode to be sure the price is displayed somewhere.

Relevant Documentation:
https://docs.woocommerce.com/wc-apidocs/function-woocommerce_variable_add_to_cart.html
https://toolset.com/documentation/user-guides/views-shortcodes/

This support ticket is created 5 years, 6 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by steveL-9 5 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#1301991
Bello_Bathtowel_no_prices.PNG
Bello_Bathsheet.PNG

I am trying to:
Products (variable product) with 1 attribute (color) does not show the price when you select a Color. It *WILL* work if you set both the Sale price and Regular price. But if you only have regular prices set for all variations then the price will never show up.

Link to a page where the issue can be seen:
hidden link
I expected to see:
Prices for all variations should show up when you select a variation, regardless of whether there is a sale price or regular price.

Instead, I got:
If a product has ONLY regular prices for all variations, it will not show the product price. if AT LEAST ONE of the variations has a sale price then ALL of the variations will show their prices properly.

On the Bello page:
hidden link

The Bath Sheet is a product whose Color Almond has a regular AND sale price. Thus all variations will show their correct prices when selected.

The Bath Towel is another product, but all variations have only their Regular prices set, with NO sale prices, thus, no prices show up at all when you select the Color.

The Layout for this entire page is: "Single Style with Products"

The VIEW that is used for these products is: "Products for a Style"

#1302331

Hi can you confirm this behavior happens when you have a default theme like Twenty Nineteen active, and only Toolset and WooCommerce plugins active? If not, can you tell me if you're using any WooCommerce extensions? If you can add your site's debug information that will be helpful.

#1302423

Okay and I can see there is at least one relevant custom plugin in use here: woocommerce-steversio-ajax-addtocart-variations

Is the problem occurring with that plugin deactivated? I'm not sure if you wanted me to make changes on the live site so I didn't test it myself.

#1305581

Yes it still occurs with that plugin deactivated.

I apologize i never got an email stating you responded. I'll check back more frequently.

Please feel free to make any (reversable) changes you need to. Or if you just want to point me in the right direction? It just seems so odd for this behavior to be happening and I thought i narrowed it down to the Toolset shortcode specifically, thus why I'm here on your support forums.

Thank you for all your help so far!

#1305927

Okay thanks, and you are correct in that it can definitely be narrowed down to Toolset and WooCommerce. I was able to replicate the issue on my own local site in a View of Products, so I will escalate this to my 2nd tier support team for additional investigation. I'll let you know what I find out. Thanks for your patience.

#1308911

Okay it turns out this is actually the expected behavior for this shortcode. It's not so much because there is no sale price, as it is all the variations for this product currently have the same price. To understand what is happening, you can temporarily deactivate Toolset plugins and visit one of the variable product posts directly. You'll see that the main price is displayed above the variation select field. If you select one of the variations, no additional price is displayed. However, in one of the variable products where the prices are different in at least one variation, the individual variation price is displayed when you select that variation. So it's not so much a Toolset bug as it is a side effect of how WooCommerce's variable product add-to-cart feature works. Toolset's shortcode is just a wrapper for the same functionality produced by WooCommerce. So I guess you have the option to report this to WooCommerce as a bug in their core functionality, or possibly show the price above the wpv-woo-buy-or-select shortcode using the wpv-woo-product-price shortcode to help clarify things for variable products with no price variations. Let me know if you have questions about that.

https://docs.woocommerce.com/wc-apidocs/function-woocommerce_variable_add_to_cart.html

#1309585

Thank you so much for looking into this.

You guys have the best support; going above and beyond. I will add the [wpv-woo-product-price] to my markup. I didnt realize this was the behavior of the wpv-woo-buy-or-select. Perhaps that's something they could add to the documentation for it?

I think the way you guys designed it is the most versatile. Along with woocommerce. I think my lack of understanding about the shortcode is what caused the issue.

Thank you again for everything.

#1309587

My issue is resolved now. Thank you!