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
- Adding nofollow to a PHP generated Nav
- How to show part of the_content?
- Wp-login appears White Screen, Error: Cannot modify header information
- How to remove the cufon script from Dzonia Lite theme [closed]
- get_the_tags() not iterating through for/while loop, but will with foreach
- Hide categories that are not used in the post type
- Automated Cart Update With Alert Box Each Time
- Two Different Links for Same Product – WooCommerce [closed]
- Issue adding sub category programmatically
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How do I add custom bulk actions to multiple custom post types?
- Add_action not working in required file of functions.php
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- dividing sub-categories by parent category – WordPress
- Show prices with tax in Woocommerce Mini Cart [closed]
- Woocommerce product variation backorder
- Status 400 for AJAX POST Request with admin-ajax.php
- Problem with custom plugin using AJAX to pull info from php file
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- Woocommerce hook run after an Order been created through REST API
- How can I apply_filters from inside a function?
- Get and insert order email address to the PHP template inside HTML text
- what is the best practice to add new field to an api route
- Modify HTML structure of fields in woocommerce checkout form
- Grab posts by multiple categories
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Can’t access variable outside for loop
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- add custom link to wordpress media gallery modal
- Auto-update products after they were published – Woocommerce
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Reload part of checkout on changed shipping method
- How to get all shipping rates and costs without session in woocommerce?
- Display a specific category of products in shop page and disable code for specific actions
- If no products are on sale – hide ID or class
- Woocommerce related product text
- Woocommerce api: create product with images – bad request
- Trying to build simple deposit code that hooks into woocommerce
- Need Help Fixing My Iframes [closed]
- WooCommerce Webhooks not firing because of error in wp-includes/meta.php
- Different Minimum Order Amounts based on Shipping Zone [closed]
- do search in two site and show the result in first site
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Add a product to checkout via form
- Avoid parallax images hardcoding
- Improve page speed loading using CDN and async or defer attribute
- Trying to place a custom field after the total section in the checkout page in woocommerce
- WordPress default Search function inconsistent in WooCommerce Product Titles
- Which field should I edit to make the checkbox marked by default?
- Displaying Woocommerce Product Category in WordPress
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- WooCommerce: How can I get orders with a custom ID in order meta data object?
- wordpress + woocommerce display product with additional information [closed]
- how to fix error “called incorrectly, should not be accessed directly”?
- populate form fields in a loop with ajax
- Function works when I don’t login to WordPress but when I login then it doesn’t work
- Error in custom php function doesn’t exist
- Customizer: active_callback and sanitize_callback incompatibility?
- How to auto fetch customer details in Woocommerce in checkout page
- Displaying custom taxonomy on WooCommerce product page
- Sum the total amount of a specific product purchased per user and display in table
- post created but no permalink
- Change “add to cart” button color based on Woocommerce product category [closed]
- How can I get the values of my WordPress $wpdb query in Jquery?
- How can I pass a custom/dynamic product to the Woocommerce cart?
- Add to cart function not working for first product when cart is empty [closed]
- I want to add custom add to cart link [closed]
- How to make products with no cost in WooCommerce
- Woocommerce : Can’t get product info in loop
- WooCommerce custom product dimensions
- Populate editor with some content of a page with a page template
- Trouble checking if custom woocommerce checkout field is empty or not
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Incorrect amount of posts returned when filtering related Woo products by custom taxonomy
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Validation algorithm in checkout field
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Menu jumping when calling it via PHP
- How do I remove the product thumbnail link from a specific div in Woocommerce? [closed]
- Displaying recent posts on static page with template-part via shortcode
- How to edit widget code to add unique class name to each div?
- My new button is in the wrong place
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Skt full width basic slideshow problem
- WordPress Woocommerce – Product Type [closed]
- How to disable controls in theme customizer?
- How do I link a button I created in theme customizer to a function?
- Trying to retrieve post meta
- can i fetch a custom metabox data in another page or post type?
- Pagination for custom shop loop woocommerce
- Is there a way to conditionally check whether a WordPress post title is empty?
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?