Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created October 18, 2018 08:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/6d2594f71dba101186b22797dfab835a to your computer and use it in GitHub Desktop.
Save plugin-republic/6d2594f71dba101186b22797dfab835a to your computer and use it in GitHub Desktop.
<?php
/**
* Prevent products being purchased from archive
* @return Boolean
*/
function pewc_filter_is_purchasable( $is_purchasable, $product ) {
if( is_archive() ) {
return false;
}
return $is_purchasable;
}
add_filter( 'woocommerce_is_purchasable', 'pewc_filter_is_purchasable', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment