Comments (2)
Thank you for reporting, this is a known issue. Offcanvas uses same hook for alerts like the account page. In case if you edit something in your account, it can be that an alert is shown in offcanvas instead in the top of the page. The alert in offcanvas is neccessary for feedback if you do a wrong login or registration in offcanvas.
For us so far, the benefit of using offcanvas login and dashboard is much more higher than the bug with the alerts on account page. We are planning to general refactor the WooCommerce alerts handling in bootScore, but this has a minor priority.
Using default WC login
You can hotfix that very easy by using the default WooCommerce login and dashboard instead of offcanvas.
Delete user offcanvas
Open header.php
in your child, search for following snippet and delete it:
<!-- offcanvas user -->
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvas-user">
<div class="offcanvas-header bg-light">
<span class="h5 mb-0"><?php esc_html_e('Account', 'bootscore'); ?></span>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div class="my-offcancas-account">
<?php include get_template_directory() . '/woocommerce/myaccount/my-account-offcanvas.php'; ?>
</div>
</div>
</div>
Change the user <button>
to an <a>
and link it to the my-account
page.
Search in header.php
for the user offcanvas toggler:
<!-- User Toggler -->
<button class="btn btn-outline-secondary ms-1 ms-md-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvas-user" aria-controls="offcanvas-user">
<i class="fas fa-user"></i>
</button>
Replace toggler with this:
<!-- User Toggler -->
<a href="[my-account]" class="btn btn-outline-secondary ms-1 ms-md-2">
<i class="fas fa-user"></i>
</a>
from bootscore.
Another idea is to generally remove alerts in offcanvas and do a redirect to my-account.php
if login failed instead.
Found something here: woocommerce/woocommerce#11864
// Redirect to my-account if offcanvas login failed
add_action( 'woocommerce_login_failed', 'redirect_on_login_failed' , 10, 0 );
function redirect_on_login_failed() : void {
// Logout user doesn't have session, we need this to display notices
if ( ! WC()->session->has_session() ) {
WC()->session->set_customer_session_cookie( true );
}
wp_redirect( wp_validate_redirect( wc_get_page_permalink( 'myaccount' ) ) );
exit;
}
// Redirect to home on logout (optional)
add_action('wp_logout','auto_redirect_after_logout');
function auto_redirect_after_logout(){
wp_redirect( home_url() );
exit();
}
If user login failed in checkout page, it redirects to myaccount
as well.
ToDo
- Remove hook in
my-account-offcanvas.php
- Remove jQuery to keep offcanvas open in
woocommerce/js/woocommerce.js
- Add redirect snippet to
woocommerce-functions.php
from bootscore.
Related Issues (20)
- Get wp_title() in header.php HOT 5
- Rewrite main.scss
- Matomo Wordpress-Plugin
- Woocommerce add to cart restrictions
- [Feature Request] Remove limitation wpsites_query HOT 3
- [BUG] Not able to scroll page using Divi page editor on Tab and Mobile view HOT 7
- Overwrite SCSS variables
- [BUG] Woocommerce Products Shortcode HOT 3
- Unable to style an active navbar item
- Unable to close a photo from the media gallery when enlarged or go back HOT 9
- Create assets folder HOT 4
- [BUG] Potential Woocommerce Bug in the Slide out Basket HOT 2
- [BUG/Help Wanted] Pagination for Post HOT 3
- [BUG] Double eye in account offcanvas HOT 1
- Reason of using fixed-top HOT 1
- <header><footer> inside <main>
- [BUG] Dark Mode Plugin HOT 3
- [BUG] Edit single product page
- Wrong Isotope usage HOT 5
- Please reopen Issue 759 as it is not resolved HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootscore.