Forum Replies Created

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter rafix

    (@rafix)

    Is there anyone who knows a solution to this?

    Thread Starter rafix

    (@rafix)

    Hi Mike,

    I’ve tried the woocommerce_get_price_html filter you’ve given me. However this still did not catch the suffix to appear.

    So you know how to get the last suffix to appear? What would the costs be for this and how long would this take?

    With kind regads

    Thread Starter rafix

    (@rafix)

    Any update on the suffix thread.

    Thread Starter rafix

    (@rafix)

    So all the prices that are above the (incl. BTW) are excluding VAT

    So what we want to make appear at the products that do not have the suffix yet is:

    {price ex}
    ({price inc} incl. BTW)

    I’ve also contacted woothemes and gave login details there, can you access these?

    Thread Starter rafix

    (@rafix)

    Hi claudio,

    The filters get added into a different file, they are located in the child theme’s functions.php as you can see in earlier posts.

    I’ve tried adding the new filter into here as well, and into the wc product. However both did not seem to make the suffix appear at the simple products.

    /**
     * @snippet       Disable Variable Product Price Range
     * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
     * @sourcecode    https://businessbloomer.com/disable-variable-product-price-range-woocommerce/
     * @author        Rodolfo Melogli
     * @compatible    WooCommerce 2.4.7
     */
    
    add_filter( 'woocommerce_variable_sale_price_html', 'bbloomer_variation_price_format', 10, 2 );
    
    add_filter( 'woocommerce_variable_price_html', 'bbloomer_variation_price_format', 10, 2 );
    
    function bbloomer_variation_price_format( $price, $product ) {
    
    // Main Price
    $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );
    $price = $prices[0] !== $prices[1] ? sprintf( __( 'vanaf %1$s <small class="woocommerce-price-suffix">excl. BTW</small>', 'woocommerce' ), wc_price( $prices[0] ) ) : 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 = $prices[0] !== $prices[1] ? sprintf( __( 'vanaf %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
    
    if ( $price !== $saleprice ) {
    $price = '<del>' . $saleprice . '</del> <ins>' . $price . '</ins>';
    }
    return $price;
    }
    Thread Starter rafix

    (@rafix)

    New link posted due too much php

    https://pastebin.com/H1v9amre

    Thread Starter rafix

    (@rafix)

    I Hope this is the code you meant earlier! If not please do tell!

    [ Moderator note: excessive amount of PHP redacted, please use pastebin.com instead and share the link to your paste. ]

    Thread Starter rafix

    (@rafix)

    Hi Claudio,

    Thanks for joining the forum post.

    Can you specify which code you want to see?

    With kind regards

    Thread Starter rafix

    (@rafix)

    Hi Mike,

    Thank you for helping me out so much. However this filter already is in the code and doesn’t catch the suffix at the simple product.

    Any more options we can try out, to get the suffix to appear?

    Thread Starter rafix

    (@rafix)

    Hi Mike,

    This did not seem to do anything, I added the snippet into the functions.php right above the other suffix. However.. No result. Is there anything else we could try? Maybe you could try this for us?

    Thread Starter rafix

    (@rafix)

    So where do I need to place these then. Only in the functions file? can you be a bit more detailed? on which and where to edit these in so it will hopefully work ??

    Thread Starter rafix

    (@rafix)

    It shows i can add two placeholders, however we want the text to be shown which is custom added. We cannot do this through the suffix part in woocommerce?

    I’ve tried the custom route. I went into the functions.php, there I added the following:

    // define the woocommerce_price_html callback
    function filter_woocommerce_price_html( $price, $instance ) {
        // make filter magic happen here...
        return $price;
    };
    
    // add the filter
    add_filter( 'woocommerce_price_html', 'filter_woocommerce_price_html', 10, 2 );

    Then I went to the /includes/abstracts/abstract-wc-product.php file and added under rule 957 the following line:

    $price = apply_filters( 'woocommerce_price_html', $price, $this );

    However this doesn’t seem to give any result in the website. what am I doing wrong?

    Thread Starter rafix

    (@rafix)

    The code supports texts at the product like:

    ( 'vanaf %1$s <small class="woocommerce-price-suffix">excl. BTW</small>'

    We’d like these to stay, I removed the code and seen what happend. But then it doesn’t show the custom lines we do want there. How would or should we change the code. To keep those there, and have the simple product show the suffix as well.

    Thread Starter rafix

    (@rafix)

    We have the option checked with:

    ({price_including_tax} incl. BTW)

    Or are you recommending to remove previous code and place with this?
    As I believe no suffix will be shown anymore then.

    Thread Starter rafix

    (@rafix)

    This seems to work for the products that do have it.

    /**
     * @snippet       Disable Variable Product Price Range
     * @how-to        Watch tutorial @ https://businessbloomer.com/?p=19055
     * @sourcecode    https://businessbloomer.com/disable-variable-product-price-range-woocommerce/
     * @author        Rodolfo Melogli
     * @compatible    WooCommerce 2.4.7
     */
    
    add_filter( 'woocommerce_variable_sale_price_html', 'bbloomer_variation_price_format', 10, 2 );
    
    add_filter( 'woocommerce_variable_price_html', 'bbloomer_variation_price_format', 10, 2 );
    
    function bbloomer_variation_price_format( $price, $product ) {
    
    // Main Price
    $prices = array( $product->get_variation_price( 'min', true ), $product->get_variation_price( 'max', true ) );
    $price = $prices[0] !== $prices[1] ? sprintf( __( 'vanaf %1$s <small class="woocommerce-price-suffix">excl. BTW</small>', 'woocommerce' ), wc_price( $prices[0] ) ) : 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 = $prices[0] !== $prices[1] ? sprintf( __( 'vanaf %1$s', 'woocommerce' ), wc_price( $prices[0] ) ) : wc_price( $prices[0] );
    
    if ( $price !== $saleprice ) {
    $price = '<del>' . $saleprice . '</del> <ins>' . $price . '</ins>';
    }
    return $price;
    }
Viewing 15 replies - 1 through 15 (of 17 total)