• Hi @morki ,
    I am the author of this deposit plugin https://ww.wp.xz.cn/plugins/deposits-for-woocommerce/ We have a user who is using this plugin along with our plugin, and it has caused a conflict.

    you are using a filter to display the booking meta in order items using this code

    add_filter( 'woocommerce_display_item_meta', array( $this, 'display_booking_dates_in_checkout' ), 10, 3 );

    The error occurs with partial payments when we create child orders that contain no products; instead, we only apply a fee to allow customers to pay the remaining balance. The code you implemented triggers an error because these child orders lack any associated products. To address this issue, simply include the following condition before line 90. includes/common/class-wceb-checkout.php

    $order_type = $item->get_order()->get_type();

    // fix conflict with deposit plugin: https://ww.wp.xz.cn/plugins/deposits-for-woocommerce/
    if ( 'shop_deposit' === $order_type ) {
    return $html;
    }
    $product = $item->get_product();

    Alternatively, you can include a action that allows other plugin developers to set conditions. At present, I manually apply this fix to the client’s website, but as you know, any modifications will be overwritten with a plugin update.

    Thanks,
    Niloy

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Noushka

    (@morki)

    Hi!

    Thank you for reporting the issue and providing a solution.
    Would the following code work instead of yours?

    $product = $item->get_product();

    if ( ! is_a( $product, 'WC_Product' ) ) {
    return $html;
    }

    If not, I think I will opt for the action hook, as I’m not so inclined to add code for very specific plugins (apart from WooCommerce ones).

    Please keep me informed 🙂

    Regards,
    Natasha

    Thread Starter Niloy – Codeixer

    (@im_niloy)

    It does not solve the issue because $product = $item->get_product(); is a throw error since the order does not have any items.

    Plugin Author Noushka

    (@morki)

    Allright, what about this?

    $product = is_callable( array( $item, 'get_product' ) ) ? $item->get_product() : false;

    if ( ! $product ) {
    return $html;
    }
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Integration with the Deposit plugin’ is closed to new replies.