• Resolved zalemcitizen

    (@zalemcitizen)


    Hello there,
    I wish to use your plugin with a WP install where I put Woocommerce in mu-plugins. Unfortunately yout plugin refuses to work if it does not detect woocommerce activated as regular plugin.

    I managed to trick your verification located in WPO_WCPDF::is_woocommerce_activated() by hooking like this :

    • enable a flag in a ‘muplugins_loaded’ hook
    • check flag is ON in a ‘option_active_plugins’ hook and if so push ‘woocommerce/woocommerce.php’ to plugins array (coming from in active_plugins)
    • disable flag in a ‘plugins_loaded’ hook fired lately (ex: 99)

    This is working but that would be nice that your plugin could check if WC does not exists in WPMU_PLUGIN_DIR

    If someone’s wonder why to use a flag: if you don’t, when WP core do_action( ‘option_active_plugins’ ) for its own purposes, it gets your woocommerce push to the unserialized active_plugins option and this may cause you some trouble (at least an updated option with as many [‘woocommerce/woocommerce.php’] as plugins you enabled/disabled and a persistent notice in dashboard complaining about woocommerce not found among plugins).

    • This topic was modified 1 year, 10 months ago by zalemcitizen.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor alexmigf

    (@alexmigf)

    Hi @zalemcitizen

    MU plugins have some caveats, no sure what’s your setup but would a hook filter to bypass the verification suit your needs?

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @zalemcitizen,

    Since we haven’t heard back from you in the last two weeks, we’re assuming you found a way to achieve what you wanted, so I’ll go ahead and mark this ticket as Resolved.

    Feel free to reply to this topic is you still need help with this, or open a new topic if you have any other questions!

    Thread Starter zalemcitizen

    (@zalemcitizen)

    @alexmigf

    Yes it would suits.
    Sure it has caveats, especially for updating them, or just get informed about an available update.

    Best regards

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @zalemcitizen,

    Thanks for confirming that a filter may be help.

    Please download, install and activate this beta release in a testing/staging site: https://we.tl/t-x2d3MNatej

    Then, please add this code snippet to your site to force the WooCommerce activation:

    /**
     * PDF Invoices & Packing Slips for WooCommerce:
     * Forces the value returned by the WooCommerce check as true.
     */
    add_filter( 'wpo_wcpdf_is_woocommerce_activated', '__return_true' );

    Let us know if it works correctly!

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi?@zalemcitizen,

    I’m pleased to notify you that our last release that we just launched a few minutes ago (v3.3.2), already include the filter hook I used in the code snippet above: wpo_wcpdf_is_woocommerce_activated

    This means that you do not need to use the beta version I shared with you in my previous message, but only update your plugin to the latest version and the use the code snippet above.

    Thread Starter zalemcitizen

    (@zalemcitizen)

    Thanks !
    Good support !

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Thanks for your kind words, @zalemcitizen: We try to do our best! ??

    By the way, if you don’t mind and have the time, do you think you could leave us a review?

    Thanks in advance and all the best with your store!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Requirement for Woocommerce in Must Use plugins’ is closed to new replies.