Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter jamelescroc

    (@jamelescroc)

    Hello! I have already contacted WooCommerce and have been in touch since last week regarding the COGS. You have already patched it in version 4.9.4 following my report. For the other issue, ShipStation has also made a correction since I submitted a report on their side as well. Thank you, have a great day!

    Thread Starter jamelescroc

    (@jamelescroc)

    I just tested with version 4.9.3 and there’s no difference; the application continues to make synchronization requests with “modified_after” set to 2 weeks late, despite there being orders from just a few minutes ago. There really seems to be a problem with the cursor. Also, you haven’t fixed the COGS log spam issue.

    Bug: get_cogs_value() called without checking if COGS feature is enabled (v4.9.3)

    File: includes/api/rest/class-orders-controller.php, line ~868

    Current code:

    php

    $unit_cost = is_callable( array( $item, 'get_cogs_value' ) ) ? $item->get_cogs_value() : 0;

    Problem: Since WooCommerce 9.5.0, get_cogs_value() exists on WC_Order_Item regardless of whether the “Cost of Goods Sold” feature is enabled. When COGS is disabled, calling this method triggers a wc_doing_it_wrong notice on every call. Since this line runs for every order item on every ShipStation sync, it generates millions of log entries.

    Fix: Check the woocommerce_cogs_enabled option before calling the method:

    php

    $cogs_enabled = 'yes' === get_option( 'woocommerce_cogs_enabled', 'no' );
    $unit_cost    = $cogs_enabled && is_callable( array( $item, 'get_cogs_value' ) ) ? $item->get_cogs_value() : 0;

    Ideally, cache the option lookup in a class property to avoid calling get_option() on every item in a loop.

    Environment: WooCommerce 10.5.3, ShipStation plugin 4.9.3

    Thread Starter jamelescroc

    (@jamelescroc)

    Hello!

    Unfortunately, I made the modifications directly on the compiled version of your plugin. I am attaching a link to the modified version and the documentation of the changes. The Mu plugin for FlyingPress compatibility is also included! For future modifications, I will use the non-compiled version and submit it on GitHub. https://drive.google.com/drive/folders/1wB692cEWsrcltBl6Q1_gb43BP9IBZlkb?usp=sharing

    Thank to you for this excellent plugin!

    Thread Starter jamelescroc

    (@jamelescroc)

    Hello! Thanks for fast reply 🙂

    Yes, yesterday I managed to get a client on the phone and I connected via TeamViewer. I conducted several tests, including purging all caches, which is already done with each update. I cleared the OPcache, the page cache, and even tried adding a new version number to all the CSS and JS files of your plugin. I also cleared the client-side cache, but nothing worked; simply reverting to the old version worked immediately. However, I forgot to check the client’s Safari version, but I did a comparative analysis of the two versions of the plugin with cline, and here’s what the report said.

    # Technical Report: Safari Compatibility Issue
    ## Easy Login WooCommerce Plugin v3.0.1

    **Date:** November 25, 2025

    ---

    ## Executive Summary

    The Easy Login WooCommerce plugin version 3.0.1 fails to function on Safari browsers due to incompatible JavaScript syntax. Login/registration forms appear disabled (grayed out and non-clickable) in both popup and inline modes. The root cause is the use of modern ES6+ JavaScript features not supported by Safari versions prior to 14.1 (April 2021).

    ---

    ## Problem Description

    ### Symptoms
    - Login and registration buttons are grayed out and non-clickable
    - Forms do not display when triggered
    - Issue affects both popup mode and inline forms (e.g., My Account page)
    - Works correctly on Chrome, Firefox, and Edge
    - **Only affects Safari browsers**

    ### Affected Safari Versions
    - Safari Desktop < 14.1 (pre-Big Sur 11.3)
    - Safari iOS < 14.5
    - All older Safari versions

    ---

    ## Root Cause Analysis

    The file
    assets/js/xoo-el-js.js in version 3.0.1 uses modern JavaScript syntax that causes fatal errors in Safari, preventing the entire script from executing.

    ### Critical Issues Identified

    #### 1. Static Class Fields (PRIMARY ISSUE)
    **Location:** Line 467 in xoo-el-js.js

    javascript<br>// PROBLEMATIC CODE (v3.0.1)<br>class CodeFormHandler {<br> static instances = new WeakMap(); // ❌ Safari < 14.1 FAILS HERE<br> // ...<br>}<br>

    **Safari Support:** Safari 14.1+ only (April 2021)
    **Impact:** FATAL - Entire script stops executing

    #### 2. Object Spread Operator
    **Location:** Line 667

    javascript<br>// PROBLEMATIC CODE<br>form_data = { ...form_data, ..._thisObj.resendData }; // ❌ Safari < 11.1 fails<br>

    **Safari Support:** Safari 11.1+ (March 2018)

    #### 3. Default Function Parameters
    **Location:** Multiple locations (lines 7, etc.)

    javascript<br>// PROBLEMATIC CODE<br>function parse_notice( message, type = 'error' ) { // ❌ Safari < 10 fails<br>

    **Safari Support:** Safari 10+ (September 2016)

    #### 4. Advanced For...Of with Destructuring
    **Location:** Line 8

    javascript<br>// POTENTIALLY PROBLEMATIC<br>for (const &#091;name, value] of formData.entries()) {<br>

    ---

    ## Proposed Solution

    ### Option 1: Transpile with Babel (RECOMMENDED)
    Use Babel to convert modern JavaScript to ES5 compatible code. This maintains code readability while ensuring compatibility.

    **Implementation:**
    bash<br>npm install --save-dev @babel/core @babel/cli @babel/preset-env<br>

    Babel config:
    json<br>{<br> "presets": &#091;<br> &#091;"@babel/preset-env", {<br> "targets": {<br> "safari": "10"<br> }<br> }]<br> ]<br>}<br>

    ### Option 2: Manual Code Refactoring

    #### Fix 1: Replace Static Class Field
    javascript<br>// BEFORE (v3.0.1 - BROKEN)<br>class CodeFormHandler {<br> static instances = new WeakMap();<br> constructor($codeForm) {<br> const existing = CodeFormHandler.instances.get($codeForm&#091;0]);<br> if (existing) return existing;<br> // ...<br> CodeFormHandler.instances.set($codeForm&#091;0], this);<br> }<br>}<br><br>// AFTER (FIXED for Safari)<br>class CodeFormHandler {<br> constructor($codeForm) {<br> // Initialize static instances if not exists<br> if (!CodeFormHandler._instances) {<br> CodeFormHandler._instances = new WeakMap();<br> }<br> <br> const existing = CodeFormHandler._instances.get($codeForm&#091;0]);<br> if (existing) return existing;<br> // ...<br> CodeFormHandler._instances.set($codeForm&#091;0], this);<br> }<br>}<br>

    #### Fix 2: Replace Spread Operator
    javascript<br>// BEFORE (BROKEN)<br>form_data = { ...form_data, ..._thisObj.resendData };<br><br>// AFTER (FIXED)<br>form_data = $.extend({}, form_data, _thisObj.resendData);<br>// OR using Object.assign<br>form_data = Object.assign({}, form_data, _thisObj.resendData);<br>

    #### Fix 3: Replace Default Parameters
    javascript<br>// BEFORE (BROKEN)<br>function parse_notice( message, type = 'error' ) {<br> return xoo_el_localize.html.notice&#091; type ].replace( '%s', message );<br>}<br><br>// AFTER (FIXED)<br>function parse_notice( message, type ) {<br> type = type || 'error';<br> return xoo_el_localize.html.notice&#091; type ].replace( '%s', message );<br>}<br>

    #### Fix 4: Simplify For...Of Loop
    javascript<br>// BEFORE (POTENTIALLY PROBLEMATIC)<br>for (const &#091;name, value] of formData.entries()) {<br> if (result&#091;name]) {<br> if (!Array.isArray(result&#091;name])) {<br> result&#091;name] = &#091;result&#091;name]];<br> }<br> result&#091;name].push(value);<br> } else {<br> result&#091;name] = value;<br> }<br>}<br><br>// AFTER (MORE COMPATIBLE)<br>formData.forEach(function(value, name) {<br> if (result&#091;name]) {<br> if (!Array.isArray(result&#091;name])) {<br> result&#091;name] = &#091;result&#091;name]];<br> }<br> result&#091;name].push(value);<br> } else {<br> result&#091;name] = value;<br> }<br>});<br>

    ---

    ## Comparison: v2.9.6 vs v3.0.1

    ### Version 2.9.6 (Working)
    - Uses ES5 compatible JavaScript
    - No static class fields
    - No spread operators
    - Works on all Safari versions

    ### Version 3.0.1 (Broken)
    - Introduces new verification code features (OTP)
    - Uses modern ES6+ syntax
    - Breaks on Safari < 14.1
    - Added ~400 lines of new code for CodeFormHandler class

    ---

    ## Files Requiring Modification

    1. **Primary:** easy-login-woocommerce.3.0.1 (1)/easy-login-woocommerce/assets/js/xoo-el-js.js
    - Lines to modify: 7, 8, 467, 667
    - Estimated changes: 15-20 lines

    2. **Secondary (CSS - Minor):** assets/css/xoo-el-style.css
    - Remove content-visibility property (line ~585)
    - Replace with standard visibility property

    ---

    ## Testing Recommendations

    After implementing fixes, test on:
    - Safari 10.x (macOS Sierra)
    - Safari 11.x (macOS High Sierra)
    - Safari 12.x (macOS Mojave)
    - Safari 13.x (macOS Catalina)
    - Safari 14.0 (macOS Big Sur 11.0-11.2)
    - Safari iOS 12, 13, 14

    ---

    ## Impact Assessment

    ### Current Impact
    - **Users Affected:** All Safari users with versions < 14.1
    - **Market Share:** Approximately 15-20% of web users
    - **Functionality Lost:** Complete login/registration system failure
    - **Business Impact:** HIGH - Core e-commerce functionality broken

    ### Post-Fix Impact
    - **Browser Compatibility:** Safari 10+ (September 2016 and later)
    - **Code Performance:** Minimal impact (transpiled code slightly larger)
    - **Maintenance:** Requires build step if using Babel

    ---

    ## Recommended Action Plan

    1. **Immediate:** Implement manual code fixes (Option 2)
    2. **Short-term:** Set up Babel transpilation pipeline
    3. **Long-term:** Establish browser compatibility testing in CI/CD
    4. **Release:** Version 3.0.2 with Safari fixes

    ---

    ## Additional Notes

    - The plugin author may not have tested on Safari during v3.0.1 development
    - Modern JavaScript features are beneficial but require transpilation for broad compatibility
    - Consider adding a browser compatibility notice in plugin documentation
    - Recommend minimum Safari version requirement or transpilation in future releases

    ---

    **Report Generated:** November 25, 2025

    Thread Starter jamelescroc

    (@jamelescroc)

    and if you got a lot of php warning message like this : [29-Sep-2023 18:58:51 UTC] PHP Warning: Undefined variable $conn in /home/intellis/xxxxxxx.com/wp-content/plugins/cookie-script-com/cookie-script.php on line 395

    edit file cookie-script.php line 378 to 394

    and replace this

    public function cookie_script_generate_url() {
    
    
        $url = null;
    
        switch ($this->item_connection_type) {
            case 1:
                $conn = "//cdn.";
                break;
            case 2:
                $conn = "//eu.";
                break;
            case 3:
                $conn = "//ca.";
                break;
            case 4:
                $conn = "//ca-eu.";
                break;
        }

    whit this

       public function cookie_script_generate_url() {
    
        $url = null;
        $conn = "";
    
        switch ($this->item_connection_type) {
            case 1:
                $conn = "//cdn.";
                break;
            case 2:
                $conn = "//eu.";
                break;
            case 3:
                $conn = "//ca.";
                break;
            case 4:
                $conn = "//ca-eu.";
                break;
            default:
                $conn = "";
                break;
        }
    Thread Starter jamelescroc

    (@jamelescroc)

    solution : edit file cookie-script.php and replace : line 418 to 449 .

    replace that :

    public function cookie_script_deactivation() {
            wp_dequeue_script("cookie_script");
        }
    
        // Clean up DB after uninstalling plugin
        public function cookie_script_uninstall() {
    
            if (!current_user_can("activate_plugins")) {
                return null;
            }
    
            delete_option("cookie_script_item_id");
            delete_option("cookie_script_item_src");
            delete_option("cookie_script_item_connection_type");
            delete_option("cookie_script_location");
            delete_option("cookie_script_location_in_element");
    
            wp_dequeue_script("cookie_script");
            wp_deregister_script("cookie_script");
    
        }
    
    }
    
    new CookieScript();
    
    // Make sure there is no cookie script in document while plugin is deactivated
    register_deactivation_hook( __FILE__, array("CookieScript", "cookie_script_deactivation") );
    
    // Clean up DB after uninstalling plugin
    register_uninstall_hook( __FILE__, array("CookieScript", "cookie_script_uninstall") );
    

    ………………………………………………………………………

    per that

        public static function cookie_script_deactivation() {
        wp_dequeue_script("cookie_script");
    }
    
    // Clean up DB after uninstalling plugin
    public static function cookie_script_uninstall() {
    
        if (!current_user_can("activate_plugins")) {
            return null;
        }
    
        delete_option("cookie_script_item_id");
        delete_option("cookie_script_item_src");
        delete_option("cookie_script_item_connection_type");
        delete_option("cookie_script_location");
        delete_option("cookie_script_location_in_element");
    
        wp_dequeue_script("cookie_script");
        wp_deregister_script("cookie_script");
    
    }
    
    }
    
    $new_instance = new CookieScript();
    
    // Make sure there is no cookie script in document while plugin is deactivated
    register_deactivation_hook( __FILE__, array($new_instance, "cookie_script_deactivation") );
    
    // Clean up DB after uninstalling plugin
    register_uninstall_hook( __FILE__, array($new_instance, "cookie_script_uninstall") );
    Thread Starter jamelescroc

    (@jamelescroc)

    Or maybe it’s due to this error code: 11-Sep-2023 23:20:02 UTC] PHP Notice: The register_rest_route function was called incorrectly. The REST API route definition for ownid/v1/getSessionByLoginID does not have the necessary permission_callback argument. For REST API routes that are intended to be public, use __return_true as a permission callback. Please read Debugging in WordPress for more information. (This message was added in version 5.5.0.) in /home/intellis/xxxx.com/wp-includes/functions.php on line 5897. it appears several times in the error log

    • This reply was modified 2 years, 8 months ago by jamelescroc.
Viewing 7 replies - 1 through 7 (of 7 total)