Skip Navigation

[Resolved] Multi variation price display

This support ticket is created 8 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
- 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 3 replies, has 2 voices.

Last updated by Luo Yang 8 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#403351

Pat

Hello,
I'm using WC and wants to display the product price in the product page (Views content). For this, I'm using the [wpv-woo-product-price] shortcode. That's OK is the product is single of with the same price for all variations.
If the product has several variations with different prices, then, this shortcode always return the min / max prices. I want to display the price related to the current chosen variation. Which shortcode do I need to use for this?

Regards
Pat

#403602

Dear Pat,

Please try with another shortcode [wpv-woo-buy-options]
For Variable products, user will be presented with a drop-down menu of Variations to select from.
https://toolset.com/documentation/views-shortcodes/#wpv-woo-product-price

#403613

Pat

Hi Luo,
I know this shortcode and I have it also in my content Views. The problem here is that this shortcode display only price variation when they are different prices for each variation. If the same price is applied to all variations, this shortcode does not display anything.
So currently, I need to use both shorcodes, knowing that they are not displaying the same way in term of positionand design, which is ennoying !
I think the good way will be to have a kind of generic shortcode that could display dynamically the variation prices but also, the single product price.
Regards
Pat

#404019

You will need to try with some custom PHP codes.
The View's shortcode [wpv-woo-product-price] is using woocommerce function get_price_html() to get the product price, see source code of woocommerce-views plugin, file \woocommerce-views\Class_WooCommerce_Views.php, line 3660~3685:

public function wpv_woo_product_price_func($atts) {	
...
	   $product_price=$product->get_price_html();
 ...
	}

And in the function get_price_html() of woocommerce plugin, you can customize the product price as what you want with the filter woocommerce_get_price_html, see the source of woocommerce plugin:
hidden link

public function get_price_html( $price = '' ) {
...
        return apply_filters( 'woocommerce_get_price_html', $price, $this );
    }
This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.