Request

This came in from a Stack Overflow question called WooCommerce Link Product Visibility To Day Of Week

Required Plugins

Code

  1. Copy the WooCommerce template file content-product.php to your theme’s woocommerce directory
  2. Change the area where it checks for visibility

FROM

TO

  1. Add the following to your functions.php file

WooCommerce Admin Setup

  1. Add tags to all of your products
  • “All Days” or “all days” (just be sure to change the value of $all_days above to whatever you set it to be – monday, tuesday, wednesday)

Thinking

I couldn’t find a method to break out of WooCommerce’s loop and set the product visibility before hand so a template update was necessary.

Result

The results aren’t updated with this option, but it shows in this example that there is more products than are displayed.

Image: Display of WooCommerce product archive page showing specific days products only.

Disclaimer

Maje Media LLC cannot be held responsible for the functionality of this code. Please make sure you test it on a development site before adding the code to your production website. There is no support available for this (and other) code snippet(s) posted on this website. If you’d like Maje Media to do custom development to help with your custom implementation please send a contact request.

Leave a Reply

Your email address will not be published. Required fields are marked *