Created
December 14, 2018 03:04
-
-
Save carlosonweb/d955f211fbf7ddeba52e3a5ede53deec to your computer and use it in GitHub Desktop.
Move the WooCommerce Notices on the Beaver Themer Singular Product Layout to Anywhere on the layout via a Custom Shortcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* First, remove WooCommerce Notices box from its default location on the page (somewhere at the top). | |
*/ | |
remove_filter( 'fl_theme_builder_before_render_content', 'FLThemeBuilderWooCommerceSingular::before_render_content' ); | |
/** | |
* Create this shortcode : [fl_woocommerce_notices] | |
* You can embed this anywhere on the Themer Layout via the HTML module. | |
*/ | |
add_shortcode( 'fl_woocommerce_notices', function() { | |
ob_start(); | |
if ( function_exists('wc_print_notices') ) { | |
?> | |
<div class="fl-theme-builder-woo-notices fl-row fl-row-fixed-width"> | |
<?php wc_print_notices(); ?> | |
</div> | |
<?php | |
} | |
return ob_get_clean(); | |
}); |
I agree. Thanks for sharing @ethanclevenger91.
This is an amazing piece of code! I can't fathom why this isn't built into Beaver Themer.
It recently stopped working for me though. Are you aware of any updates with Beaver Themer or WooCommerce that would make this no longer usable?
Hi @edellingham. That's coming up in Themer 1.4. There'll be a new module (Woo Notices) that one can simply drop to the Product Layout that would reposition it from its default location, which is at the top of the content area. As far as the above code goes, it still works for me.
Here's a screen recording on my test site.
Looks like more troubleshooting for me then. I appreciate the quick response and update!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
FLThemeBuilderWooCommerceSingular::before_render_content
filter does more than just output the notices, so you should probably put back the other bits after removing that filter. I would add: