Skip to content

Conversation

Axos11
Copy link
Contributor

@Axos11 Axos11 commented Apr 19, 2025

  • Creates an ajax login for woocommerce in the offcanvas user account.
  • The implementation has 2 main goals
    1. Better user experience. Login happens immediately and the user can directly access his account
    1. Removes one of the last parts of the template that makes full page caching possible even for logged in users.
  • Optout of ajax login: add_filter('bootscore/wc_ajax_login', '__return_false');

Docs

  • Filters and action hooks - Republish draft
  • Migration - Republish draft
  • Translations
  • WooCommerce - Republish draft
    • Sensei

MarkusKab and others added 7 commits April 14, 2025 09:28
Moves the AJAX login functionality for WooCommerce into separate JavaScript and PHP files.

This allows for easier exclusion of the login script when not needed, improving page load times and performance.
It also enhances code organization and maintainability by separating concerns.
Moves the AJAX login functionality for WooCommerce into separate JavaScript and PHP files.

This allows for easier exclusion of the login script when not needed, improving page load times and performance.
It also enhances code organization and maintainability by separating concerns.
@crftwrk crftwrk added this to v6.2.0 Apr 19, 2025
@crftwrk crftwrk moved this to In Progress in v6.2.0 Apr 19, 2025
@crftwrk crftwrk added documentation Improvements or additions to documentation feature WooCommerce labels Apr 19, 2025
@crftwrk
Copy link
Member

crftwrk commented Apr 22, 2025

@Axos11 @MarkusKab Thank you, this is hot!

We need to do some changes before merging. Tried to do them directly in this PR but I have no permission to change files. So, I created a PR to your branch risingBYTES#1. If you agree, please merge it, then your PR will be updated.

Check https://dev.bootscore.me, just type something into the login form and click the login button. This PR does following:

  • Deleted unwanted language backup files that have been created by Loco Translate. This removes 6500 lines of unused code ;-)
  • Removes the last empty line in functions.php. Think this line was mistakenly added, but there are no changes in this file. Just to avoid confusion and probably conflicts with other PR's.
  • Added missing file headers and updated existing file versions.
  • Formatted all files from TAB to 2 spaces like all other files in the theme.

Loader

If you have a slow connection, then login offcanvas opens empty and it need some seconds to show the form. When you click the Login button, it seems that nothing happens. But we have to tell the user that something happens when offcanvas is open and when clicked the Login button.

  • Added a class ajax-loading to the body in ajax-login.js This class is added while something loads and removed when loaded.
  • Added an action <?php do_action( 'bootscore_before_my_offcanvas_account' ); ?> to offcanvas-woocommerce.php.
  • Hooked a loader to this action in wc-ajax-login.php

Now, when open the offcanvas or clicking the login button, a loader is shown to tell the user that there is something in progress.

Please review the files and if you agree, merge it into your branch. Feel free to make changes, you have the permission for that. When done, we should test this on some live sites for one week and share links to them before merging your PR into the theme.

Just for the docs

New Action:

<?php do_action( 'bootscore_before_my_offcanvas_account' ); ?>

New Filter:

/*
 * Disable AJAX login
 */
add_filter('bootscore/wc_ajax_login', '__return_false');

Agree with this changes?

Delete unwanted files, add a loader and reformat to 2 spaces

- todo
-- check translations in js
-- move notification on error to offcanvas only
-- try to use the loader on offcanvas only
@crftwrk
Copy link
Member

crftwrk commented Apr 23, 2025

@Axos11 thanks for merging. Have installed this here for testing:

Let's test this for at least one week before merging in to the theme.

  • Triple check the translation files, maybe you're right and we have to re-add them.
  • Maybe a better solution for the body loader class?

If you have this installed on live sites as well, please share links.

Axos11 added 3 commits April 23, 2025 13:59
Refactors the AJAX login functionality to enhance the loading experience and simplify the logic.

- Uses CSS to only show loader in offcanvas.
- Only loads the account content once after opening the offcanvas.
- Adds loader only during initial form loading.
- Simplifies loader management for improved clarity.
@crftwrk crftwrk assigned crftwrk and unassigned crftwrk Apr 24, 2025
@crftwrk crftwrk self-requested a review April 24, 2025 16:51
Copy link
Member

@crftwrk crftwrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@crftwrk crftwrk merged commit cfbeeed into bootscore:main Apr 28, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in v6.2.0 Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature WooCommerce
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants