• Resolved cobrains

    (@cobrains)


    Hi!
    for my woocommerce I need that when there are only virtual products in the cart, the gift wrapping optin is disabled.
    In plugin faq I found this function

    add_filter( ‘giftwrap_exclude_virtual_products’, ‘__return_true’ );

    but it gave me a lot of problem with Gutenberg block editor.
    Is there a way to achieve that with another function?

    Thank you

    • This topic was modified 2 years, 6 months ago by cobrains.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Little Package

    (@littlepackage)

    Hi @cobrains

    …but it gave me a lot of problem with Gutenberg block editor.

    We need more information about “a lot of problem” before we continue here. What sort of problems? What did you see? How do you know it was caused by this filter? (What made you draw that connection?) In order for us to fix anything, we need to be able to duplicate the problem. So, please tell us, step-by-step, how we can also see this problem. What is your setup like? What versions of WooCommerce, Gift Wrapper and WordPress and PHP are you using, where did you put this PHP code, and then what next?

    Thank you.

    Thread Starter cobrains

    (@cobrains)

    Hi!
    I found out that the problem was caused by that filter because, when I find a worpress malfunction, I always start removing the custom php I’ve used (that is usually the problem). In this way I found out that the string

    add_filter( 'giftwrap_exclude_virtual_products', '__return_true' );

    was the problem.

    I can see this error in guthenberg editor and I can’t save anything. But when I remove the filter everything works correctly.
    I’m currently using Salient theme V13.0.6, Wrdpress V5.8.1, woocommerce V5.7.1 and Woocommerce Gift Wrapper V4.4.10
    I hope this Issue could be fixed.

    Thank you

    • This reply was modified 2 years, 6 months ago by cobrains.
    Plugin Author Little Package

    (@littlepackage)

    @cobrains Good sleuthing, good reporting, thank you for finding that bug. It has to do with is_admin() not catching Gutenberg (because Gutenberg spans frontend/backend) and then an undefined constant shutting down the Gutenberg AJAX. Whew. I’ve just released version 4.5 of the plugin. Please give that a try.

    Thread Starter cobrains

    (@cobrains)

    It seems to work perfectly!
    Thank you very much for the fast support, have a nice day 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘hide gift wrapping when only virtual products in the cart php not workinkg’ is closed to new replies.