• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Checkout
  • Cart
  • Videos

How to Restrict Products from Being Sold on a Single Day To 1 Category in WooCommerce

$75.00

Demo Video
Category: WooCommerce Tag: woocommerce_is_purchasable
  • Description

These PHP code snippets enable you to restrict the sales of products to 1 specific category on a specific day. Example : If you only want flowers from 1 specific category to be sold on valentines day, you can set the date on the code and the category so only flowers from that one category can be sold on a specific date.

This removes the add to cart button from all products in all other categories so only items in a specific category include a button allowing the product to be added to the cart.

Parent & Child Categories

The 1st code snippet applies to parent categories only and the 2nd to all category levels.

Installation

Copy & paste 1 of the 2 code snippets to the end of your child themes functions file or custom functionality plugin.

Swap out the allowed-category slug with the category slug for your specific category.

Swap out the date as well so the code only runs on a specific date.

You may also like…

  • Only Allow Products From Any Category To Be Added To Cart Once Item from Specific Category Added 1st

    Only Allow Woo Products From Any Category To Be Added To Cart Once Item from Specific Category Added 1st

    $75.00
    Add to cart
  • Add Delivery or Shipping Date Picker To WooCommerce

    Delivery Date Picker for WooCommerce

    $75.00
    Add to cart

Primary Sidebar

Cart

Code written by Brad Dalton specialist for WooCommerce with more than 10 years of experience.

Advertise · WPEngine · Genesis · Log in

  • Code Snippets
  • Tutorials
  • Videos
  • Account
  • Checkout
  • Cart
 

Loading Comments...
 

You must be logged in to post a comment.