Created
February 17, 2021 16:10
-
-
Save sirjonathan/9963ddc07c09743c13b2dd556df0c4fd to your computer and use it in GitHub Desktop.
Remove SKU from product page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove the "SKU" field on the product page | |
function woolive_remove_product_page_skus( $enabled ) { | |
// Check to make sure we're _not_ on the admin panel and that we _are_ on a product page | |
if ( ! is_admin() && is_product() ) { | |
// We're using a filter called wc_product_sku_enabled which, by default, has the SKU field enabled | |
// By returning false, we're telling it to disable the SKU field | |
return false; | |
} | |
// If our conditional check above fails (for example, when we are in the admin), continue as normal and stay enabled | |
return $enabled; | |
} | |
// Attach our function to the wc_product_sku_enabled filter | |
add_filter( 'wc_product_sku_enabled', 'woolive_remove_product_page_skus' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment