• Resolved lukem538

    (@lukem538)


    I have an issue with users managing their payments with Autoptimize enabled. The page doesn’t load correctly and users are not able to amend payment options. We have the setting unchecked to disable autoptimize on checkout. If i disable java optimisation it works so I am looking to add a script to bypass autoptimize on the Woocommerce manage payments page if possible. Currently with java optimisation disabled the site is much slower.

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    hey @lukem538;
    Assuming the payment-options page is located at /checkout/paymentoptions, then this code snippet excludes that specific page from being autoptimized;

    add_filter('autoptimize_filter_noptimize','staff_noptimize',10,0);
    function staff_noptimize() {
    	if (strpos($_SERVER['REQUEST_URI'],'checkout/paymentoptions')!==false) {
    		return true;
    	} else {
    		return false;
    	}
    }

    Alternatively you could go through the troubleshooting-steps in the AO FAQ to try to identify what JS is the culprit and try to fix by excluding that.

    Hope this helps,
    frank

    Thread Starter lukem538

    (@lukem538)

    Hi Frank,

    We tried the script but that didn’t work. Then I tried to work out which .js files are being used on the page but this looks to be multiple files and depends on which payment gateway option the user selects so i think it would be better if we can exclude it via a script.
    The location where users manage their own payments is
    /my-account/settings/add-payment-method/
    and
    /my-account/settings/payment-methods/

    Could you confirm what script we need and where it needs to be added?, our dev guy tried it on the functions.php is that correct?

    Thanks
    Luke

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    In that case I would suggest to use this code;

    
    add_filter('autoptimize_filter_noptimize','staff_noptimize',10,0);
    function staff_noptimize() {
    	if (strpos($_SERVER['REQUEST_URI'],'payment-method')!==false) {
    		return true;
    	} else {
    		return false;
    	}
    }

    and the easiest and safest way to add it would be using the code snippets plugin.

    Thread Starter lukem538

    (@lukem538)

    Hi thanks for the quick feedback. I have tried the script using code snippet but its not working?

    Presume its as simple as create a new code snippet, add a description and text, run snippet everywhere and clear the cache?
    If I have not missed anything unfortunately its still not working.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    add new snippet -> paste snippet -> run everywhere (or front-end only) -> save and activate

    so did you activate (had this problem myself on several occasions already to be honest ?? )

    Thread Starter lukem538

    (@lukem538)

    Yes, its definitely activated. Guess the script apply to any url which contains –
    “payment-method”

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    yes is does (apply to any URL which contains payment-method)

    but it seems AO isn’t even running now anyhow?

    Thread Starter lukem538

    (@lukem538)

    Yes, I am testing the issue by accessing the payment methods with JavaScript Options in AO toggled on or off. If i disable JavaScript Options its working fine. But the site is so much slower ??
    I have this disabled on live so users can amend payments but I am testing on our staging site which is setup for sandbox with braintree.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, so can you on live;
    * enable AO with HTML & CSS optimization
    * activate the code snippet

    that will allow me to do _some_ tests on your live without any adverse effects on your customers ??

    Thread Starter lukem538

    (@lukem538)

    Could you drop me an email as you will need a user account to access the logged in pages?
    [email protected]

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    update; code snippet was added on production and the payment-option pages were indeed not optimized any more, payment options and changing payment options worked.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Woocommerce user manage payments’ is closed to new replies.