• After updating to WooCommerce 3 my variations prefix/suffix are not working.

    How to add the prefix/suffix to variation price?
    What is the alternative to woocommerce_get_variation_price_html?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    I think it’s just woocommerce_get_price_html for all product types.

    Thread Starter P Roy

    (@raviry)

    No, It’s not working. In Woocommerce 3 Following method has been removed from plugin/woocommerce/includes/class-wc-product-variation.php

    /**
    	 * Get variation price HTML. Prices are not inherited from parents.
    	 *
    	 * @return string containing the formatted price
    	 */
    	public function get_price_html( $price = '' ) {
    
    		$display_price         = $this->get_display_price();
    		$display_regular_price = $this->get_display_price( $this->get_regular_price() );
    		$display_sale_price    = $this->get_display_price( $this->get_sale_price() );
    
    		if ( $this->get_price() !== '' ) {
    			if ( $this->is_on_sale() ) {
    				$price = apply_filters( 'woocommerce_variation_sale_price_html', '<del>' . wc_price( $display_regular_price ) . '</del> <ins>' . wc_price( $display_sale_price ) . '</ins>' . $this->get_price_suffix(), $this );
    			} elseif ( $this->get_price() > 0 ) {
    				$price = apply_filters( 'woocommerce_variation_price_html', wc_price( $display_price ) . $this->get_price_suffix(), $this );
    			} else {
    				$price = apply_filters( 'woocommerce_variation_free_price_html', __( 'Free!', 'woocommerce' ), $this );
    			}
    		} else {
    			$price = apply_filters( 'woocommerce_variation_empty_price_html', '', $this );
    		}
    
    		return apply_filters( 'woocommerce_get_variation_price_html', $price, $this );
    	}
    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    I just said it uses woocommerce_get_price_html now for all product types.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[3.0] woocommerce_get_variation_price_html filter missing in WooCommerce 3.0’ is closed to new replies.