added a check for woocommerce to avoid fatal error when woocommerce is disabled