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

    (@azragh)

    Anyone? Is it such a dumb question that it gets ignored?

    I know I can round prices globally but that messes with the calculations of other plugins and the local system of our client – so I’d like to round prices only if there is a discount.

    Plugin Author pimwick

    (@pimwick)

    Not a dumb question! There isn’t currently a way to round to .05 however we will take a look to see if there is a possible solution.

    Thread Starter Azragh

    (@azragh)

    Many thanks, that would be nice. =)

    Plugin Author pimwick

    (@pimwick)

    We just released a new version of the plugin that includes a hook to make this possible.

    To get the update:

    1. Log into your WordPress Admin area.
    2. Click on Plugins -> Installed plugins.
    3. Scroll down to “Black Friday and Cyber Monday for WooCommerce” and click “Check for updates.”
    4. The page will refresh, then scroll back down and click on “Update.”

    After upgrading, follow the instructions in our guide for rounding prices:

    https://www.pimwick.com/pw-faq/rounding-prices/

    For reference, here is the code that can be added to your functions.php file or via the Code Snippets plugin:

    function custom_pwbf_discounted_price( $price, $deal ) {
        if ( $deal->deal_type == 'percentage' ) {
            $price = round( $price / 0.05 ) * 0.05;
        }
    
        return $price;
    }
    add_filter( 'pwbf_discounted_price', 'custom_pwbf_discounted_price', 10, 2 );
    Thread Starter Azragh

    (@azragh)

    Works like a charm, thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘round discount prices’ is closed to new replies.