• I’m running WP 5.1.1 with WooCommerce 3.6.2 and Mailpoet 3 3.24.0 and version 1.1.5 of your plugin.

    When enabling and setting up your plugin 3 things happen:

    – The checbox appears as it should on the checkout page ??

    – The payment part on the checkout page hangs with a turning wheel, and it is impossible to proceed to the payment ??

    – I get three debug warning messages on the front-page of the site (not the other pages) with errors: “Trying to get property of non-object in … wp-includes/class-wp-query.php” for lines 3918, 3920 and 3922 ??

    When I disable you plugin things go back to normal.

    The problem also remains when your plugin is active even if I untick the checkbox “Enable subscription”

    This seems to be the exactly same problem as in a previous support question: “Woocommerce – Mailpoet Plugin breaks the functioning of the checkout page”.

    Was that problem ever resolved?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter christer_f

    (@christer_f)

    I did a little bit of debugging, which may give a hint.

    Both the hang-problem and the warnings come from the call to is_checkout() (function defined by Woocommerce) in the function class-mpwa-frontend-fields/mpwa_frontend_fields_init_posts_selection().

    (And in the is_checkout function the problem comes from the is_page call)

    So, basically, if I remove the test is_checkout from the condition in class-mpwa-frontend-fields/mpwa_frontend_fields_init_posts_selection() things seem to work.

    Hope this helps to allow you to make a fix

    Thread Starter christer_f

    (@christer_f)

    It’s me again.
    The problem comes from the use of the action-hook ‘posts_selection’ which is used instead of ‘woocommerce_checkout_update_order_review’ at the end of class-mpwa-frontend-fields.php.

    This hook is used unless you set the place of the tickbox field to be before or after the submit button. the ‘post_select’ action hook is active on ALL pages, hence the warnings I had on the home page. According to WordPress documentation this hook is to be used by caching plugins, and it does not seem right to use it here. Try to find a suitable Woocommerce action hook instead.

    Until this is fixed, for other people having the same problem: set the “Subscription position” to either “Before Order Submit” or “After Order Submit”

    Hello,

    Thanks for the detail debugging info. We are looking forward to solve the issue

    [ Signature deleted ]

    • This reply was modified 5 years, 6 months ago by Jan Dembowski.

    Hello,

    We have tested our plugin in various WordPress installations and checked each subscription position. We didn’t get any error. In your case, it might be plugin confliction issue. Could you please provide all/full debug and PHP error?

    [ Signature deleted ]

    • This reply was modified 5 years, 6 months ago by Jan Dembowski.
    Thread Starter christer_f

    (@christer_f)

    Hello,
    Sorry for the delay.
    Since I have moved on I haven’t kept the debug output. However, please look at your plugin code at the bottom of the file class-mpwa-frontend-fields.php:

    if ( $subscription_field_position == 'review_order_before_submit' || $subscription_field_position == 'review_order_after_submit' ) {
      add_action( 'woocommerce_checkout_update_order_review', 'mpwa_frontend_fields_init_posts_selection' );
    } else {
      add_action( 'posts_selection', 'mpwa_frontend_fields_init_posts_selection' );
    	}
    

    Clearly, unless you put the checkbox before or after submit in the plugin settings, the plugin will use the action ‘post_selection’ instead of ‘woocommerce_checkout_update_order_review’ to call mpwa_frontend_fields_init_posts_selection.

    What does this mean?

    1) your function ‘mpwa_frontend_fields_init_posts_selection’ now executes on ALL pages and posts of the site, not only at the woocommerce checkout page. This does not sound like a good idea at all.

    2) The WordPress documentation of the ‘post_selection’ action states that it is called BEFORE the query is run. This means that the tests you do in the mpwa_frontend_fields_init_posts_selection, such as is_page(), will not work correctly (and in my case results in a hang). The WordPress documentation states that this action hook is primarily to be used by cache plugins. This seems natural, since such plugins will want to examine the query BEFORE it is run to see if the result can be found in the cache.

    Hope this helps

    Hello,

    Thanks for your time to put all the info here. You are correct. However, it is hard to fix the issue without getting the full debug/PHP error since the plugin works perfectly in our end. We tested in several WordPress installations and subscription positions. So please provide the full debug/error log so that we can fix the issue and test it multiple times in order to release error free version.

    [ Signature deleted ]

    • This reply was modified 5 years, 6 months ago by Jan Dembowski.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Activating the plugin blocks the payment section on the checkout page’ is closed to new replies.