• Activity Feed
  • Groups
  • Forums
  • Service
  • en_USEnglish
    • arArabic
    • zh_TWChinese
    • fr_FRFrench
    • de_DEGerman
    • jaJapanese
    • es_ESSpanish
    • pt_PTPortuguese
  • classify
    • Plugins & Themes
      • Gutenberg Block Developer
      • Plugin Development
      • Plugin Usage and Recommendation
      • Theme Development & Customization
    • Speed & Optimization
      • Database Optimization
      • Page Load optimization
      • Server Level Optimization
    • Security & Backup
      • Data Backup & Recovery
      • Site Security Measures
      • SSL Certificates
    • Server Ops & Admin
      • Automatic Management
      • Performance Monitoring & Tuning
      • Server Selection & Configuration
      • System Security Update
    • Dev Tools & Workflow
      • Continuous Integration/Continuous Deployment (CI/CD)
      • Development Environment Configurations
      • Version Control
    • REST API & Integrations
      • Integration with Third-Party Services
      • REST API Use
    • FAQs & Solutions
      • Debugging Tips
      • Error Detection
    • Code Snippets & Dev Tips
      • Code Snippets Library
      • Developer Tips
    • Advanced Extensions
      • Customized Content Type (CPT)
      • Multisite Management
    • SEO Tips
      • Content Optimization Tips
      • Sitemap and Robots.txt
      • SEO Optimization Techniques

    Shopping Cart

    No products in the cart.
    Sign in Sign up

    Shopping Cart

    No products in the cart.
    • Activity Feed
    • Groups
    • Forums
    • Service
    • en_USEnglish
      • arArabic
      • zh_TWChinese
      • fr_FRFrench
      • de_DEGerman
      • jaJapanese
      • es_ESSpanish
      • pt_PTPortuguese
    • classify
      • Plugins & Themes
        • Gutenberg Block Developer
        • Plugin Development
        • Plugin Usage and Recommendation
        • Theme Development & Customization
      • Speed & Optimization
        • Database Optimization
        • Page Load optimization
        • Server Level Optimization
      • Security & Backup
        • Data Backup & Recovery
        • Site Security Measures
        • SSL Certificates
      • Server Ops & Admin
        • Automatic Management
        • Performance Monitoring & Tuning
        • Server Selection & Configuration
        • System Security Update
      • Dev Tools & Workflow
        • Continuous Integration/Continuous Deployment (CI/CD)
        • Development Environment Configurations
        • Version Control
      • REST API & Integrations
        • Integration with Third-Party Services
        • REST API Use
      • FAQs & Solutions
        • Debugging Tips
        • Error Detection
      • Code Snippets & Dev Tips
        • Code Snippets Library
        • Developer Tips
      • Advanced Extensions
        • Customized Content Type (CPT)
        • Multisite Management
      • SEO Tips
        • Content Optimization Tips
        • Sitemap and Robots.txt
        • SEO Optimization Techniques
      • Profile photo of Cooper

        Cooper posted an update

        9 months ago

        Level 2

        Disable products purchases that doesn’t have specific tag in WooCommerce

        Guys I want to edit this code

        /*
         * Disable buying products from specific category and tag
         *
         * @author Misha Rudrastyh
         * @url https://rudrastyh.com/woocommerce/make-products-non-purchasable.html#specific-categories
         */
        add_filter( 'woocommerce_is_purchasable', 'misha_catalog_mode_on_for_category', 10, 2 );
        function misha_catalog_mode_on_for_category( $is_purchasable, $product ) {
            
            // Second – check product tags
            if( has_term( 'available', 'product_tag', $product->get_id() ) ) {
                $is_purchasable = true;
            }
            
            return $is_purchasable;
        }

        i want to enable add to cart button only for the post has tag called available and make add to cart button hidden on rest of ther products on woocommerce

        can anyone edit this code

        thanks in advanced

        i have tried to enable add to cart button on the selected products with tag available bu i couldn’t , actually used a plugin of woocommerce called hide price and add to cart button

        rudrastyh.com

        Make Products Non-Purchasable in WooCommerce

        How to completely disable purchasing products on your WooCommerce store or only products with specific IDs or in a certain category without plugins.

        1 Comment
        • Profile photo of Banner
          Banner
          Level 3

          To make all products unavailable on WooCommerce except those with the tag available, you need to make is purchasable false before you make it true only if your condition is met.

          /*

          * Disable buying products from specific category and tag

          *

          * @author Misha Rudrastyh

          * @url https://rudrastyh.com/woocommerce/make-products-non-purchasable.html#specific-categories

          */

          add_filter( ‘woocommerce_is_purchasable’, ‘misha_catalog_mode_on_for_category’, 10, 2 );

          function misha_catalog_mode_on_for_category( $is_purchasable, $product ) {

          $is_purchasable = false;

          // Second – check product tags

          if( has_term( ‘available’, ‘product_tag’, $product->get_id() ) ) {

          $is_purchasable = true;

          }

          return $is_purchasable;

          }

          9 months ago
      • Public
      • All Members
      • My Connections
      • Only Me
      • Public
      • All Members
      • My Connections
      • Only Me
      • Public
      • All Members
      • My Connections
      • Only Me
      © 2025 - OpenByt - The ultimate source for free WordPress knowledge
      • Home
      • Community
      • About Us
      • Contact Us
      • Join Us
      • Notice
      • Team
      • Privacy Policy
      Loading...
      en_US English
      en_US English
      fr_FR French
      de_DE German
      ja Japanese
      es_ES Spanish
      pt_PT Portuguese
      zh_TW Chinese
      ar Arabic

      Report

      There was a problem reporting this post.

      Harassment or bullying behavior
      Contains mature or sensitive content
      Contains misleading or false information
      Contains abusive or derogatory content
      Contains spam, fake content or potential malware

      Block Member?

      Please confirm you want to block this member.

      You will no longer be able to:

      • See blocked member's posts
      • Mention this member in posts
      • Invite this member to groups
      • Message this member
      • Add this member as a connection

      Please note: This action will also remove this member from your connections and send a report to the site admin. Please allow a few minutes for this process to complete.

      Report

      You have already reported this .
      Go to mobile version

      Insert/edit link

      Enter the destination URL

      Or link to existing content

        No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.