Skip to content

Instantly share code, notes, and snippets.

@carlosonweb
Created December 14, 2018 03:04
Show Gist options
  • Save carlosonweb/d955f211fbf7ddeba52e3a5ede53deec to your computer and use it in GitHub Desktop.
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
/**
* 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();
});
@carlosonweb
Copy link
Author

I agree. Thanks for sharing @ethanclevenger91.

@edellingham
Copy link

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?

@carlosonweb
Copy link
Author

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.

https://recordit.co/18pJItYnCd

@edellingham
Copy link

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