Skip to content

Instantly share code, notes, and snippets.

@Oscar-Abad-Folgueira
Last active October 15, 2022 09:37
Show Gist options
  • Save Oscar-Abad-Folgueira/9e79e35e4654f040aab087c6a11a0e8c to your computer and use it in GitHub Desktop.
Save Oscar-Abad-Folgueira/9e79e35e4654f040aab087c6a11a0e8c to your computer and use it in GitHub Desktop.
WooCommerce Snippet: Comprobar si WooCommerce está activado.
<?php
/**
* @snippet WooCommerce Snippet: Comprobar si WooCommerce está activado.
* @author Oscar Abad Folgueira
* @author_url https://www.oscarabadfolgueira.com
* @snippet_url https://oscarabadfolgueira.com/woocommerce-snippet-comprobar-si-woocommerce-esta-activado/
*/
// Comprobar si WooCommerce está en el array de plugins ativos
if ( in_array(
'woocommerce/woocommerce.php',
apply_filters( 'active_plugins', get_option( 'active_plugins' ) )
)
) {
echo "Bien! WooCommerce está activo. Gracias, majo!";
} else {
echo "Venga, activa WooCommerce o lo hago yo!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment