AI Verified

Name

Make WooCommerce product not purchasable

Language

PHP

Rating

Voted: 1 by 1 user(s)

Codevault

royeyal

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: Not Specified

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

06/07/2024

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Make WooCommerce product not purchasable

 
                    
1/***
2* Make WooCommerce product not purchasable
3* Category: WordPress Backend
4* Tags: WooCommerce
5* URL: https://techies.review/blog/some-good-to-have-php-codesnippets-for-wordpress
6*/
7add_filter( 'woocommerce_is_purchasable', '__return_false' );
8remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
9remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );

1

Comments

  • IS

    1 year ago

    This doesn't work, and I've tested on two sites.
    I'm assuming that the 10 is the Product ID, but it didn't work.

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

Woo 404 Redirect Optimizer

Added: 6 months ago

Last Updated: 6 months ago

WooCommerce

AI Verified

1

Autocomplete Virtual Orders

Added: 1 year ago

Last Updated: 8 months ago

This will autocomplete orders that are on virtual products, Had to change a small piece of code for it to work with wordpress 6.2.2 and php 8.2.6

WooCommerce

AI Verified

1

Remove Price Sorting Options in WooCommerce Catalog

Added: 5 months ago

Last Updated: 2 months ago

This code snippet removes the price sorting options ("Price" and "Price (desc)") from the sorting dropdown menu in the WooCommerce catalog. This can be useful if you want to customize the sorting opti...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

Elementor

Unverified

5

Elementor Gradients Headings

Added: 2 years ago

Last Updated: 3 months ago

CSS Code for background gradients on headings in Elementor

Elementor

Public

3

Align Icon List items to the top

Added: 1 year ago

Last Updated: 1 year ago

Align Icon List widget items to the top, instead of the middle

WooCommerce

AI Verified

1

WooCommerce hide product summary

Added: 1 year ago

Last Updated: 1 year ago

Hides the product summary in single product globally