Plugin Directory

Changeset 3320918


Ignore:
Timestamp:
07/02/2025 03:51:12 AM (9 months ago)
Author:
blockonomics
Message:

Fixed bug with calculations

Location:
blockonomics-bitcoin-payments/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • blockonomics-bitcoin-payments/trunk/blockonomics-woocommerce.php

    r3318213 r3320918  
    44 * Plugin URI: https://github.com/blockonomics/woocommerce-plugin
    55 * Description: Accept Bitcoin Payments on your WooCommerce-powered website with Blockonomics
    6  * Version: 3.7.9
     6 * Version: 3.8
    77 * Author: Blockonomics
    88 * Author URI: https://www.blockonomics.co
     
    227227   
    228228        $discount = $cart->get_subtotal() * ( $discount_percent / 100 );
    229         $cart->add_fee( __( 'Payment Method Discount', 'blockonomics-bitcoin-payments' ), -$discount, false );
    230     }
    231    
     229        if ( $discount > 0 ) {
     230            $cart->add_fee( __( 'Payment Method Discount', 'blockonomics-bitcoin-payments' ), -$discount, false );
     231        }
     232    }
     233
    232234
    233235    /**
  • blockonomics-bitcoin-payments/trunk/php/Blockonomics.php

    r3318213 r3320918  
    533533        $discount_percent = floatval( get_option( 'blockonomics_bitcoin_discount', 0 ) );
    534534        $subtotal = (float) $wc_order->get_subtotal();
     535        $total = (float) $wc_order->get_total();
    535536       
    536537        // Calculate the expected amount after applying the Bitcoin discount
    537         $expected_fiat = $subtotal - ( $subtotal * ( $discount_percent / 100 ) );
     538        $expected_fiat = $total - ( $subtotal * ( $discount_percent / 100 ) );
    538539       
    539540        $order['expected_fiat'] = $expected_fiat - $paid_fiat;
  • blockonomics-bitcoin-payments/trunk/readme.txt

    r3318213 r3320918  
    44Requires at least: 3.0.1
    55Tested up to: 6.8.1
    6 Stable tag: 3.7.9
     6Stable tag: 3.8
    77License: MIT
    88License URI: http://opensource.org/licenses/MIT
     
    7676== Changelog ==
    7777
     78= 3.8  =
     79* Fixed bugs with calculations due to discount setting
     80
    7881= 3.7.9  =
    7982* Add discount settings for payment method
Note: See TracChangeset for help on using the changeset viewer.