Forum Replies Created

Viewing 15 replies - 1 through 15 (of 23 total)
  • Thread Starter dassels43

    (@dassels43)

    Hi,

    Yes, we had checked those but the screen for enabling/disabling the debug log exists only in the network admin.

    We did manage to stop the logging, unfortunately we’re not sure exactly what it was that really stopped it. We did discover what was stopping our efforts. In an earlier attempt to stop the debug logs, we defined these variables to see if they would have any effect:

    define('LSCWP_LOG', false);
    define('LSCWP_LOG_LEVEL', 0);

    It didn’t and then we proceeded to clean up the entries in the database that had the option name “litespeed.conf.debug” set to “1”. We’re not sure why all the subsites had this value enabled but they were. This value remained set to “1” even after were uninstalled and reinstalled the plugin, which we weren’t expecting. However in multisite installs, the code reads and writes to the wp_sitemeta table as it should. So we still don’t know why in this instance toggling sitemeta on/off was having no effect either.

    For reference we have an identical site and debug logging works as expected.

    It’s possible there was a stuck value cached somewhere or, somehow we were reading subsite table entries but we don’t know. The actual fix was masked by our earlier attempt to disable the logging:

    define('LSCWP_LOG', false);

    Doesn’t actually do anything as the code in the debug function only checks for the existing of it, like this:

    Line 503 in debug.2.cls.php

    public static function debug( $msg, $backtrace_limit = false ) {
    if ( ! defined( 'LSCWP_LOG' ) ) {
    return;
    }

    If it sees ‘LSCWP_LOG’ it’s not going to exit. To save someone future troubleshooting headaches, might want to have it check both presence or value, so entering “define(‘LSCWP_LOG’, false);” will exit the function.

    Thread Starter dassels43

    (@dassels43)

    Hey there,

    Yes, it’s much improved:

    [10-Jan-2026 21:09:02 UTC] [BLOG SWITCH FIRST] 3 → 1 | Request: /subsite1/?wc-ajax=get_refreshed_fragments
    [BLOG SWITCH CALLER] class-wp-hook.php:343 {closure} → class-wp-hook.php:365 apply_filters → plugin.php:522 do_action → ms-blogs.php:587 do_action → base.cls.php:693 switch_to_blog → base.cls.php:671 _preload_blog_options → conf.cls.php:177 get_blog_option → conf.cls.php:233 load_options
    [10-Jan-2026 21:09:03 UTC] [BLOG SWITCH TOTAL] 16 total blog switches in this request


    [10-Jan-2026 21:22:18 UTC] [BLOG SWITCH FIRST] 1 → 1 | Request: /?wc-ajax=get_refreshed_fragments
    [BLOG SWITCH CALLER] class-wp-hook.php:343 {closure} → class-wp-hook.php:365 apply_filters → plugin.php:522 do_action → ms-blogs.php:527 do_action → class-wpvivid-staging.php:1002 switch_to_blog → class-wp-hook.php:341 staging_site → class-wp-hook.php:365 apply_filters → plugin.php:522 do_action
    [10-Jan-2026 21:22:19 UTC] [BLOG SWITCH TOTAL] 10 total blog switches in this request


    [10-Jan-2026 21:22:39 UTC] [BLOG SWITCH FIRST] 4 → 1 | Request: /subsite2/?wc-ajax=get_refreshed_fragments
    [BLOG SWITCH CALLER] class-wp-hook.php:343 {closure} → class-wp-hook.php:365 apply_filters → plugin.php:522 do_action → ms-blogs.php:587 do_action → base.cls.php:693 switch_to_blog → base.cls.php:671 _preload_blog_options → conf.cls.php:177 get_blog_option → conf.cls.php:233 load_options
    [10-Jan-2026 21:22:39 UTC] [BLOG SWITCH TOTAL] 68 total blog switches in this request

    Not sure why subsite 2 has a lot more than the others. I would have assumed Options are same across sites but that site in particular makes more calls. However it’s not so excessive as before and can prob live with that. Thanks for the quick fix!

    *update* – the site with the extra switches had cart items in it. Once we cleared the cart it reported 16 switches, same as the others so it’s good.

    • This reply was modified 3 months ago by dassels43.
    Thread Starter dassels43

    (@dassels43)

    Hi Lucian,

    Thanks for the follow-up! Your questions allowed us to do further testing which revealed the issue lies with a custom login form we have. The native wp-login does a check for roles before running 2FA code, so we added that in to the custom form to prevent running 2FA without a role present which seems to have fixed the issue.

    Thread Starter dassels43

    (@dassels43)

    For anyone that might have a similar issue, the rest route to whitelist is:

    /checkout/?wc-ajax=wc_ppcp_frontend_request

    Thread Starter dassels43

    (@dassels43)

    Hi Yordan,

    Thanks for the fix, works great, and good solution!

    Thread Starter dassels43

    (@dassels43)

    Sure, it’s this one, the latest 4.1.1.

    Thread Starter dassels43

    (@dassels43)

    Hi,

    Ok, I tried again with the latest version and this seems to be working correctly. Thanks for the quick update!

    Thread Starter dassels43

    (@dassels43)

    Hi, sorry I missed your reply. Unfortunately I don’t have any screenshots of merchant center at the time of the issue as I was able to modify the code to disable the restriction for GoogleBot specifically. This is the code in question:

    // woo-product-country-base-restrictions/include/products-restriction.php

    /*
    * Check restricted by the product id for simple product
    *
    * @since 1.0.0
    */
    public function is_restricted_by_id( $id ) {
    $restriction = get_post_meta( $id, '_fz_country_restriction_type', true );


    // If Googlebot we exit so it can track the pages in GSC
    if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
    {
    return false;
    }

    if ( 'specific' == $restriction || 'excluded' == $restriction ) {
    $countries = get_post_meta( $id, '_restricted_countries', true );
    if ( empty( $countries ) || ! is_array( $countries ) ) {
    $countries = array();
    }

    $customercountry = $this->get_country();

    if ( 'specific' == $restriction && !in_array( $customercountry, $countries ) ) {
    return true;
    }

    if ( 'excluded' == $restriction && in_array( $customercountry, $countries ) ) {
    return true;
    }
    }

    return false;
    }

    This block of code somehow affects certain user agents, like Google and Bing (but not Yahoo for some reason). I’m guessing it must be the way the bot accesses the page, leading to a 404 error if the product is set to be restricted. Could also be related to which country the googlebot server is coming from, I’m not sure. I added the line:

    // If Googlebot we exit so it can track the pages in GSC

    if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot"))
    {
    return false;
    }

    To exit the function if the plugin encounters googlebot. One could add other bots if necessary depending on their situation.

    I think you can replicate the issue by creating some products in Woo and setting some restrictions on them and then testing with https://botsimulator.com/index.php

    It was not an easy issue to track down because when testing the links on Google Search Console, the live test would work but the normal inspection from the indexer would return 404.

    Thread Starter dassels43

    (@dassels43)

    For anyone that wants a work around, you can do the following:

    Update functions.php in your child theme:

    /**
    * Add a new country to countries list
    */
    add_filter( 'woocommerce_countries', 'add_eu_to_dropdown' );
    function add_eu_to_dropdown( $countries ) {
    $new_countries = array('EU' => __( 'European Union', 'woocommerce' ),
    );

    return array_merge( $countries, $new_countries );
    }

    Then edit this plugin with the following:

    	/*
    * Save the product meta settings for simple product
    *
    * @since 1.0.0
    * @para $post_id
    */
    public function save_custom_product_fields( $post_id ) {
    $restriction = isset($_POST['_fz_country_restriction_type']) ? sanitize_text_field($_POST['_fz_country_restriction_type']) : '';
    if (! is_array($restriction)) {

    if ( !isset( $_POST['_restricted_countries'] ) || empty( $_POST['_restricted_countries'] ) ) {
    update_post_meta( $post_id, '_fz_country_restriction_type', 'all' );
    } else {
    if ( !empty( $restriction ) ) {
    update_post_meta( $post_id, '_fz_country_restriction_type', $restriction );
    }
    }

    $countries = array();

    if (isset($_POST['_restricted_countries'])) {
    $countries = isset($_POST['_restricted_countries']) ? wc_clean( $_POST['_restricted_countries'] ) : '';
    }

    $eu_countries = array( 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' );

    if ( ! empty( $countries ) && is_array( $countries ) && in_array( 'EU', $countries )) {
    $countries = array_merge($countries, $eu_countries);
    } else {
    $countries;
    }

    update_post_meta( $post_id, '_restricted_countries', $countries );
    }
    }

    /*
    * Save the product meta settings for variation product
    *
    * @since 1.0.0
    * @para $post_id
    */
    public function save_custom_variation_fields( $post_id ) {
    $restriction = isset($_POST['_fz_country_restriction_type'][ $post_id ]) ? sanitize_text_field($_POST['_fz_country_restriction_type'][ $post_id ]) : '';

    if ( !isset( $_POST['_restricted_countries'] ) || empty( $_POST['_restricted_countries'] ) ) {
    update_post_meta( $post_id, '_fz_country_restriction_type', 'all' );
    } else {
    if ( !empty( $restriction ) ) {
    update_post_meta( $post_id, '_fz_country_restriction_type', $restriction );
    }
    }

    $countries = array();
    if (isset($_POST['_restricted_countries'])) {
    $countries = isset( $_POST['_restricted_countries'][ $post_id ] ) ? wc_clean( $_POST['_restricted_countries'][ $post_id ] ) : '';
    }

    $eu_countries = array( 'AT', 'BE', 'BG', 'CY', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GR', 'HU', 'HR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK' );

    if ( ! empty( $countries ) && is_array( $countries ) && in_array( 'EU', $countries )) {
    $countries = array_merge($countries, $eu_countries);
    } else {
    $countries;
    }

    update_post_meta( $post_id, '_restricted_countries', $countries );
    }

    Basically, we want to change how the 2 functions “save_custom_product_fields” and “save_custom_variation_fields” save the data. Note that on next update this will need to be updated again until this or similar feature is implemented by Zorem.

    Thread Starter dassels43

    (@dassels43)

    We’re using a page builder called “Bricks Builder”. This allows you to configure the checkout form fields. You can remove fields from the form in the editor and it won’t show in the front end. Exactly how it achieves this I don’t know as I haven’t looked into the code.

    Anyway, removing the fields directly in functions.php seems to work and allow the checkout to continue whilst also removing the fields from the frontend.

    Thread Starter dassels43

    (@dassels43)

    Ok, we found the issue. The new checkout is looking for billing fields “phone” and “address2” to exist. We remove this from the checkout as this information is not required in order to process the transaction since it is only digital products that are sold. If we put the back the fields the JS error goes away. There should be a modification to the JS code to allow that to be optional. The legacy version doesn’t generate JS validation for those fields not existing.

    Thread Starter dassels43

    (@dassels43)

    Hi, here is the system report:

    https://gist.github.com/dassels/556db362651e74c0dea7ab45c5494974

    There are no fatal errors or any other info in the log, as this seems to be purely JS related and those aren’t picked up the logger.

    This is the only entry that shows when the debug is turned on in Stripe:

    2024-04-27T07:21:09+00:00 Debug ====Stripe Version: 8.2.0==== ====Stripe Plugin API Version: 2019-09-09==== ====Start Log==== account ====End Log====
    • This reply was modified 1 year, 11 months ago by dassels43.
    dassels43

    (@dassels43)

    I doubt this will get patched. Last update was 9 months ago and now it’s been removed from the WP repository and support is not responding. I’d start looking for another solution.

    Thread Starter dassels43

    (@dassels43)

    Hi Yordan, we are using a custom template based off the simple version. However, your question led us to investigate and compare the methods used, and we see it has changed from “invoice_number()” to “number( $this->get_type() )”. We updated accordingly and it is now working without the warning.

    Thread Starter dassels43

    (@dassels43)

    Hi Megan,

    There is no option anymore to “activate anyway” or “ignore”. They (Woocommerce) removed this option a few updates back.

    Since, as you confirmed, only the code needed to confirm HPOS compatibility is missing, we can manually add this in the meantime until the update goes through. Do you have a recommendation as to where to put the code?

Viewing 15 replies - 1 through 15 (of 23 total)