Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter KyleStark

    (@kylestark)

    after trying different things that is on that woocommerce page above.

    Im not sure im able to pick the Default Form Values: as a listed only price.

    Thread Starter KyleStark

    (@kylestark)

    I found where he did it. Now im trying to figure out how to show the set price. ??

    // Main Price
    $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );
    $price = wc_price( $prices[0] );
    
    //Sale Price
     //$prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) );
    //$saleprice = wc_price( $prices[0] );
    
    if ( $price !== $saleprice ) {
    $price = '<del>' . $saleprice . '</del> ' . $price . '';
    }
    return $price;
    }

    Im reading through this but im an amatuer at php
    https://docs.woothemes.com/wc-apidocs/class-WC_Product_Variable.html

    I can see how to edit min or max but I’m looking for the middle price :).

    Thread Starter KyleStark

    (@kylestark)

    Hey Mike,

    Thank you for the help!

    yeah, I am testing removing the files tonight just to be sure. I have found where he edited the code in the functions.php file.

    /add_filter('woocommerce_related_products_args','wc_remove_related_products', 10);
    
    add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
    
    function woo_remove_product_tabs( $tabs ) {
    
        unset( $tabs['description'] );      	// Remove the description tab
        //unset( $tabs['reviews'] ); 			// Remove the reviews tab
        unset( $tabs['additional_information'] );  	// Remove the additional information tab
    
        return $tabs;
    
    }
    add_action( 'woocommerce_after_shop_loop_item_title', 'my_add_short_description', 4 );
    function my_add_short_description() {
    	$excerpt= substr(get_the_excerpt(),0, 150);
    	 echo '<span class="title-description">' .  $excerpt . '...</span><br />';
    }
    add_filter( 'woocommerce_variable_sale_price_html', 'bbloomer_variation_price_format_only_min', 10, 2 );
    
    add_filter( 'woocommerce_variable_price_html', 'bbloomer_variation_price_format_only_min', 10, 2 );
    
    function bbloomer_variation_price_format_only_min( $price, $product ) {
    
    // Main Price
    $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );
    $price = wc_price( $prices[0] );
    
    // Sale Price
    $prices = array( $product->get_variation_regular_price( 'min', true ), $product->get_variation_regular_price( 'max', true ) );
    sort( $prices );
    $saleprice = wc_price( $prices[0] );
    
    if ( $price !== $saleprice ) {
    $price = '<del>' . $saleprice . '</del> ' . $price . '';
    }
    return $price;
    }
    
    add_filter( 'widget_text', 'do_shortcode' );

    I can test tonight to see which one is the actual code not using default settings. my php is weak.

    Thread Starter KyleStark

    (@kylestark)

    also, I have found a folder in the theme directory labeled woocommerce with the variation.php file in there as well but I am not seeing any differences between that one and the one in woocommerce plugin folder.

    Same here. You are actually able to use the shortcodes still though. As long as you have them in other posts or pages… hopefully updated soon.

Viewing 5 replies - 1 through 5 (of 5 total)