• We use a plugin called Retainful for our WooCommerce site.

    I added “phast_no_defer” for the “rnoc_track-user-cart” script. It works, but the wp_localize_inline script tag is not set to phast_no_defer. What do I do?

    Hope that makes sense. Here’s the relevant function in the plugin:

    /**
         * Adding the script to track user cart
         */
        function addCartTrackingScripts()
        {
            if (!wp_script_is('wc-cart-fragments', 'enqueued')) {
                wp_enqueue_script('wc-cart-fragments');
            }
            if (!wp_script_is(RNOC_PLUGIN_PREFIX . 'track-user-cart', 'enqueued')) {
                wp_enqueue_script(RNOC_PLUGIN_PREFIX . 'track-user-cart', $this->getAbandonedCartJsEngineUrl(), array('jquery'), RNOC_VERSION, false);
                $user_ip = $this->getClientIp();
                $user_ip = $this->formatUserIP($user_ip);
                $data = array(
                    'ajax_url' => admin_url('admin-ajax.php'),
                    'version' => RNOC_VERSION,
                    'public_key' => self::$settings->getApiKey(),
                    'api_url' => self::$api->getAbandonedCartEndPoint(),
                    'tracking_element_selector' => $this->getTrackingElementId(),
                    'cart_tracking_engine' => self::$settings->getCartTrackingEngine()
                );
                $data = apply_filters('rnoc_add_cart_tracking_scripts', $data);
                wp_localize_script(RNOC_PLUGIN_PREFIX . 'track-user-cart', 'retainful_cart_data', $data);
            }
        }
Viewing 1 replies (of 1 total)
  • Plugin Author Albert Peschar

    (@kiboit)

    Hi @kw11,

    PhastPress did not yet support using the phast_no_defer attribute for scripts generated by wp_localize_script, because WordPress does not call the script_loader_tag for those scripts.

    I’ve just released PhastPress 1.81 which does support this attribute for wp_localize_script. After updating to 1.81, the issue should be resolved.

    If this is not the case, please let me know. ??

    –Albert

Viewing 1 replies (of 1 total)
  • The topic ‘PhastPress not working with Retainful scripts’ is closed to new replies.