You could check to see if the ‘WooCommerce’ class exists, then run the code that requires WooCommerce.
<?php
if ( class_exists( 'WooCommerce' ) ) {
// code that requires WooCommerce
} else {
// you don't appear to have WooCommerce activated
}
?>
Related Posts:
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- My Own layout in WooCommerce pages [closed]
- write custom woocommerce templates and forms
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- Exclude category from woocommerce product category list
- Woocommerce variable products are being added to the card on the homepage (ajax)
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- Woocommerce Convert existing order to the cart
- How to correctly add Javascript in functions.php
- Function to return true if current page has child pages
- Display sorting options dropdown when using WooCommerce product category shortcode
- How to get the registered sidebar’s name by its id?
- is there a simple way to list every templates / php files used to generate a specific page?
- Using Cookie Data For WP_Query Loop
- How do I list the_tags() into HTML data-attribute
- Using Font Awesome as post thumbnail
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- custom shortcode will not display the wrapped content
- How to prevent those PHP variables from being cached on WordPress?
- Setting All Drafts to ‘exclude-from-catalog’ in WooCommerce
- How do you add customer capability after Woocommerce purchase?
- Change sign up fee in cart for subscription products WooCommerce
- Make the first item as default on Woocommerce product category items list
- Using a variable in is_page(array())
- Trigger popup in a php if/else statement
- Anyway to output the registration form like the login form with wp_login_form()?
- Where to edit the template that is generating the code for dynamic_sidebar left-sidebar in the Understrap theme? [closed]
- How can I create a list of page titles from custom meta values?
- get_the_tags() not iterating through for/while loop, but will with foreach
- dividing sub-categories by parent category – WordPress
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- How to get all shipping rates and costs without session in woocommerce?
- how to fix error “called incorrectly, should not be accessed directly”?
- How to auto fetch customer details in Woocommerce in checkout page
- I want to add custom add to cart link [closed]
- Validation algorithm in checkout field
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- How do I remove the product thumbnail link from a specific div in Woocommerce? [closed]
- Trying to retrieve post meta
- Redirect to another page using contact form 7? [closed]
- Underscore – Self hosted fonts
- How can I use a sliced image As banner? [closed]
- Can a plugin redirect product page based on IF condition?
- How to make function appear in sentence?
- Widgets not showing on custom theme
- Remove page title in product page using a function
- woocommerce specific quantities for product
- Get all posts as an array ID => Name
- woocommerce related product title length
- How to modify mobile nav menu text in theme
- WordPress site with embedded menu – gives You don’t have permission to access /wp-content/themes/xxx/taxonomy-redirect.php on this server
- Woocommerce custom Plugin in wordpress [closed]
- How to get my [shortcode] rendered on the home page, other pages are fine
- Using php inside javascript [closed]
- Why in this WordPress theme I can’t see the Main Menu?
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- Get options from database using php class
- How to separate product payment and shipping payment in WooCommerce checkout? [closed]
- Output product category link from WP_Query
- Variation prices breakdown only for single product page
- Woocommerce disable order item link (backend) [closed]
- Set all WooCommerce Products to Simple, Virtual & Downloadable
- WordPress single.php get_header not working
- Undefined array key 0 wp-includes/capabilities.php on line 76
- How do I know if the user is a customer?
- I want to fusion the product columns in email table order
- WooCommerce is_product_category() not working
- Best way to use variables in multiple functions?
- How do I programmatically add ‘reviews_allowed’ to WooCommerce product?
- Adding new divs with custom classes to products on WooCommerce shop page [closed]
- Get product price in a different currency using WooCommerce Currency Switcher
- Store user form submitted information in post type
- Adding product permalink on admin order page throwing error
- WordPress files break if I edit them, but adding a closing PHP tag fixes it
- How to override WooCommerce Order Item Meta with data from Cart?
- How to get total gross revenue for current month in the woocommerce dashboard status widget
- Add custom attribute to product’s HTML to woocommerce cart page
- Change WooCommerce template for PDF – access to custom field
- How can i style “echo apply_filters”
- Get all woocommerce product names with price and show using core php
- How can i put php code on the wordpress page?
- How to detect if a revision was made by woocommerce or wordpress?
- How do I prevent a folder from reappearing in my home directory?
- jQuery doesn’t work in my php snippet
- Not able to get the exact URL of the file on server located in active wordpress theme
- Use WP_Query Data In Cookie
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- need help to arabic text in wordpress
- How to add custom checkout field in user details mail template
- Display Sale Price Before Regular Price (WooCommerce)
- Setting WooCommerce currency programmatically
- Using is home to get content [closed]
- How I can give a php page a style from my theme
- WooCommerce – Show ‘Sales’ badge on variable products where only some variations have sales price [closed]
- How to create a container in php then customise it in CSS
- Show button in header when product custom field is not empty
- How to change shipping method title based on cart amount?
- WordPress PHP8 Critical Error in class-wp-widget.php
- Product Search in search.php
- using custom pages for myaccount in woocommerce