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

Custom WooCommerce Sorting Names

Added: 1 year ago

Last Updated: 1 year ago

Adds a custom sorting option to the WooCommerce catalog page. The two sorting options are "Price: Low-High" and "Price: High-Low".

WooCommerce

AI Verified

0

Display Orders on User Dashboard

Added: 2 years ago

Last Updated: 1 year ago

WooCommerce

AI Verified

0

Set all WooCommerce orders to "Completed".

Added: 2 years ago

Last Updated: 1 year ago

For virtual or downloadable products, it may be disadvantageous if the status of the order is still set to "in process" or "on hold". In such cases, the product may not be downloaded or the service ma...

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: 2 years 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: 2 years ago

Last Updated: 1 year ago

Hides the product summary in single product globally