Disable Woocommerce store temporarily

Asked

Viewed 2,078 times

0

How to put a store in Wordpress made with plugin Woocommerce maintenance?

I thought to take the 'STORE' menu from the top of the site, but if someone has the link saved in the browser, could use and access normally.

I thought about disabling the plugin, but I do not know if only this will solve and when you want to return to the store, will return normally.

Remembering that there is a site in Wordpress and within it a store, what is the best way to temporarily take this store off the air? And then come back without losing any configuration?

  • I think there is a plugin for this. I only remember listening vaguely but I don’t know if it was really about Woocommerce.

  • It’s a pretty cool feature you’re asking for, but so at first I don’t think it’s an easy programming problem to solve or answer. The automated part of Woocommerce must need a "Reverse-Engineer" and has part of its own Theme. Personally, I would need a good hour to understand and solve the problem, so I vote to close as "too wide".

1 answer

1

I haven’t tested this code but I think it might work. Add it to your theme’s functions.php file.

function my_woocommerce_maintenance_mode($content) {
// condição para paginas do Woo. Mais infos: https://docs.woocommerce.com/document/conditional-tags/
    if( is_woocommerce() or is_shop() or is_product_category() or is_product_tag() or is_product() or is_cart() or is_checkout() or is_account_page() ) {
   // Mostra o que vc quiser aqui.
   $content = "Em Manutenção";
   return $content;
}
add_filter('the_content','my_woocommerce_maintenance_mode');

Maybe it’s a good idea to hide the products using CSS if you have inserted them on some page outside of woo with shortcodes for example. Something like:

.products, .product {display: none !important;}

Some things I would take into consideration:

  1. Do something so that Google does not index this page "In Maintenance". It would be boring for store customers to search and Google results only have on "Maintenance". And for that you can learn more about 503 status here: https://yoast.com/http-503-site-maintenance-seo/
  2. Maybe you want to leave this maintenance mode for everyone but you (site administrator or manager) and then just add a condition like: !current_user_can( 'manage_woocommerce' ) in the function created above.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.