Plugin Directory

Changeset 3391431


Ignore:
Timestamp:
11/06/2025 08:44:47 PM (4 months ago)
Author:
routedev
Message:

yith compatibility fix

Location:
routeapp/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • routeapp/trunk/public/class-routeapp-public.php

    r3339895 r3391431  
    364364     * Add route insurance fee in checkout and cart
    365365     * @since    1.0.0
    366      * @param  Object $cart
    367      *
    368      */
    369     public function checkout_route_insurance_fee( $cart ) {
     366     * @param  Object $cart_or_checkout
     367     * MSS-6261:The issue: checkout_route_insurance_fee is bound to hooks that pass different parameter types:
     368     * woocommerce_checkout_before_order_review -> WC_Checkout
     369     * woocommerce_cart_calculate_fees -> WC_Cart
     370     * At line 388, it assumes a WC_Cart and calls get_cart_hash(), which fails when a WC_Checkout is passed.
     371     * Fixing by detecting the object type and handling both cases.
     372    */
     373    public function checkout_route_insurance_fee( $cart_or_checkout ) {
    370374        if ( (is_admin() && ! defined( 'DOING_AJAX' )) ) return;
    371375
    372         $cart = empty($cart) ? WC()->cart : $cart;
     376        // Determine if we received a WC_Cart or WC_Checkout object
     377        $is_checkout_object = is_a( $cart_or_checkout, 'WC_Checkout' );
     378        $cart = $is_checkout_object ? WC()->cart : $cart_or_checkout;
     379       
     380        // Use WC()->cart as fallback if not a valid WC_Cart
     381        if ( is_null( $cart ) || ! is_a( $cart, 'WC_Cart' ) ) {
     382            $cart = WC()->cart;
     383        }
     384       
    373385        $checkbox = WC()->session->get( 'checkbox_checked' );
    374386
  • routeapp/trunk/readme.txt

    r3339895 r3391431  
    66Requires at least: 4.0
    77Tested up to: 6.7.1
    8 Stable tag: 2.2.28
     8Stable tag: 2.2.29
    99Requires PHP: 5.6
    1010License: GPLv2 or later
     
    106106
    107107== Changelog ==
     108
     109= 2.2.29 =
     110* Add compatibility with plugin yith-woocommerce-multi-step-checkout-premium
     111
    108112
    109113= 2.2.28 =
  • routeapp/trunk/routeapp.php

    r3339895 r3391431  
    1010 * Plugin URI:        https://route.com/for-merchants/
    1111 * Description:       Route allows shoppers to insure their orders with one-click during checkout, adding a layer of 3rd party trust while improving the customer shopping experience.
    12  * Version:           2.2.28
     12 * Version:           2.2.29
    1313 * Author:            Route
    1414 * Author URI:        https://route.com/
     
    2626 * Currently plugin version.
    2727 */
    28 define( 'ROUTEAPP_VERSION', '2.2.28' );
     28define( 'ROUTEAPP_VERSION', '2.2.29' );
    2929
    3030/**
Note: See TracChangeset for help on using the changeset viewer.