Highest price on grouped product - by ycs7a

This topic has 4 replies, 2 voices, and was last updated 6 years, 10 months ago ago by Rose Tyler

  • Avatar: ycs7a
    ycs7a
    Participant
    January 22, 2018 at 21:55

    Hi,

    Is there a way to make the price of the grouped products the total of the separate grouped products?

    For instance, I have this grouped product. I would like to have the listed amount not be: € 239,00–€ 685,00. Rather, I want the total amount to show: € 1269. Is this possible?

    Please see https://github.com/woocommerce/woocommerce/blob/21e51b9fc6a9537366cbd5ca8275ec40eacd8e61/includes/class-wc-product-grouped.php#L121

    Thank you

    3 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    January 23, 2018 at 09:03

    Hello,

    Please note that your query requests additional customization which is beyond our basic support scope.
    But you may try to achieve the needed result in such way:
    create structure xstore-child/woocommerce/single-product and file price.php
    the content of this file should be at first like woocommerce default content -> https://github.com/woocommerce/woocommerce/blob/master/templates/single-product/price.php
    then replace this http://prntscr.com/i4alr4 with

    global $product;
    $price = $product->get_price_html();
    if ( $product->get_type() == 'grouped') {
    	$children = $product->get_children();
    	$price = 0;
    	foreach ($children as $key => $value) {
    		$_product = wc_get_product( $value );
    		$price += $_product->get_price();
    	}
    	$price = get_woocommerce_currency_symbol( '' ) . ' ' . $price;
    }
    ?>
    <p class="price"><?php echo $price; ?></p>

    http://prntscr.com/i4am0f

    Regards

    Avatar: ycs7a
    ycs7a
    Participant
    February 2, 2018 at 23:23

    Thank you, I will not try for now.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    February 5, 2018 at 09:52

    You’re welcome!
    Have a nice day.

    Regards

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.