Plugin Directory

Changeset 3206152


Ignore:
Timestamp:
12/11/2024 08:38:01 AM (16 months ago)
Author:
masterhomepage
Message:

php error fix when WC_Cart is null

Location:
riskcube-von-creditreform-schweiz/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • riskcube-von-creditreform-schweiz/trunk/readme.txt

    r3192015 r3206152  
    55Tested up to: 6.3
    66Requires PHP: 7.4
    7 Stable Tag: 2.4.12.7
     7Stable Tag: 2.4.12.8
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    144144
    145145== Changelog ==
     146= 2.4.12.8 =
     147**Bug Fixes**
     148- Fixed PHP error when Cart is null
     149
    146150= 2.4.12.7 =
     151
    147152**Bug Fixes**
    148153- Fixed possible server error, when new order is created
  • riskcube-von-creditreform-schweiz/trunk/riskcube.php

    r3192012 r3206152  
    66 * Plugin Name: RiskCUBE von Creditreform Schweiz
    77 * Plugin URI:
    8  * Version: 2.4.12.7
     8 * Version: 2.4.12.8
    99 * Description: RiskCube
    1010 * Author: NXTLVL Development GMBH
  • riskcube-von-creditreform-schweiz/trunk/src/Core/RiskCube.php

    r3191967 r3206152  
    273273    public static function woocommerce_new_order($id_order)
    274274    {
    275         static::on_order_state_change($id_order);
    276     }
    277 
    278     public static function on_order_state_change($id_order)
     275        static::on_order_state_change($id_order, $from, $to_status);
     276    }
     277
     278    public static function on_order_state_change($id_order, $from, $to_status)
    279279    {
    280280        $order = wc_get_order($id_order);
    281281
    282         if (get_option('wc_riskcube_fk_confirm_state') === 'wc-' . $order->get_status()) {
     282        if (get_option('wc_riskcube_fk_confirm_state') === 'wc-' . $to_status ) {
    283283            // NXTLVL-182 in wc classic, the hooks are called in the wrong order.
    284284            // with this workaround, the order is checked wether it has been confirmed
     
    287287            $user_id = apply_filters( 'determine_current_user', false );
    288288            $isOnWhitelist = ClaimDataHelper::checkCustomerWhitelist($user_id);
    289 
    290289            if (!$is_confirmed && self::$isClassicCheckout) {
    291 
    292290                // NXTLVL-223
    293291                if (!($user_id && $isOnWhitelist)) {
     
    420418        $do_api = true;
    421419        if (array_key_exists('riskcube_auth', $sessionData) && array_key_exists('riskcube_total', $sessionData)) {
    422             if ($sessionData['riskcube_total'] == WC()->cart->get_totals()['total']) {
     420            /* Fixed error from debug log: Call to a member function get_totals() on null */
     421            $cart_total = ( WC()->cart && !WC()->cart->is_empty() ) ? WC()->cart->get_totals()['total'] : 0;
     422            if ($sessionData['riskcube_total'] == $cart_total) {
    423423                $res = $sessionData['riskcube_auth'];
    424424                $do_api = false;
Note: See TracChangeset for help on using the changeset viewer.