return defined('WC_VERSION');
should fix since defined()
accepts a string as parameter.
https://www.php.net/manual/en/function.defined.php
If you use:
require_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
adjusting your path if the installation is in a subrdir you load all the WP environment including active plugins etc
Related Posts:
- Unit tests – Dealing with dependencies
- PHPUnit testing WordPress Plugin
- Why is WP_Mock not used instead of WP_UnitTestCase for writing unit tests by most plugins?
- Unit testing for plugin development
- Vagrant script to setup all the common PHP / WordPress version combinations
- How to write testable classes in WordPress
- Implement phpunit testing on a plugin
- Unit testing to simulate the loop
- What is the best way to do unit tests for your plugin in 2018 [closed]
- WooCommerce get Shipping Class of product from either the product id or the order after order is completed
- Plugin development with unit tests
- How to iterate through custom posts and add the title to an array
- Unit testing wordpress plugins with plugin options
- Install and load additional plugins when running unit tests
- Unit Testing a Plugin functionality with cron
- product-attribute-slug-is-too-long-28-characters-max
- PHPUnit test plugin activation
- get all products of one category
- Woocommerce add custom button to backend order table
- Sample — test — data for large WordPress install
- Plugin vs Settings load order (woocommerce dependency)
- How do I hook a custom discount to change a WC_Order price total on WooCommerce?
- DataBase connection problem with PHPUnit and WordPress
- how to set context in WordPress for unit testing
- Add multiple shipping rates from add_rate function with custom ID
- set_sale_price in WooCommerce [closed]
- Woocommerce – Hide a Column in Cart Table
- PHP logging framework to be used with WordPress
- Print value of an array or variable in a payment plugin
- How to get orders with used coupon in WooCommerce
- Best way to notify WordPress plugin users of new release candidates for beta testing?
- How to update total price of completed order in woocommerce? [closed]
- Plugin development: get_post_meta is not working [closed]
- Plugin development: How many plugin and WordPress version combinations to support?
- $wpdb -> Batch insert from XML File?
- How do I change the initial quantity of a product in woocommerce?
- Order properties should not be accessed directly
- How to check if Woocommerce Order number equals to post ID?
- How do I add custom column to woocommerce cart?
- How plugins_loaded works?
- WooCommerce Conditional Tag inside plugin
- Custom attribute type not displaying terms in edit product – WooCommerce
- WooCommerce registration password field not displaying
- Show special field when correct shipping is chosen
- update woocommere total value on checkout based on selected payment method
- how to add custom functionality after woocommerce place order button
- WooCommerce Admin Reports : Get custom product report based on date range
- Adding a brand column to WooCommerce Products
- Woocommerce checkout update totals with datepicker
- Strange issue saving custom field data for a WooCommerce order
- PHP – Extend WordPress Woocommerce Revenue Analytics with custom field
- Woocommerce – Convert Delivery method into a custom field
- “import declarations may only appear at top level of a module” when importing WooCommerce API node module
- Woocommerce extend tax report with custom column
- How can we display product price $104 on the cart while the credit card payment method is checked?
- Show disclaimer with accept button before redirecting to the payment gateway website
- How do I apply a custom discount to individual product total prices depending on their categories on the cart and checkout pages of WooCommerce? [closed]
- In woocommerce cart item we can add custom text but how can i add custom link? [closed]
- Updating Woocommerce Settings API when WordPress Settings API saved and vise versa
- Can’t get woocommerce_get_price_html to work [closed]
- How to restrict access to image folder depending on whether product is purchased or not?
- How to extend WooCommerce API to show bookable product availability rules?
- Unit testing a plugin with a theme dependency
- Customize WooCommerce my account dashboard through plugin
- woocommerce_checkout_order_processed hook executing function twice
- Is there a way in which I can compare product id with the order id to display content on front end before placing the order? [closed]
- Woocommerce Composite Products – Add a composite product to cart programmatically via ajax [closed]
- Change WooCommerce Email Header using custom plugin
- UWooCommerce – add cart discount programmatically?
- Remove an action by extending class and replacing it
- Woocommerce order empty items array
- How to get all product in the woo-commerce? [closed]
- Woocommerce inventory [closed]
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- How to change WooCommerce loop product title HTML output in single product page and archive page
- Can woocommerse be used dynamically for billing from another plugin for payment processing?
- Sending an SMS on new order placed – WooCommerce
- Can we use a library under MIT license in a WooCommerce plugin?
- Set _regular_price 0 if empty in woocommerce product
- WooCommerce Endpoints content
- How remove trashed WooCommerce orders from wc_get_orders() result?
- Mock a dependency of a WP_REST_Controller class
- How to call code when adding WooCommerce menu items via woocommerce_account_menu_items
- Duplicate shipping method logic to another shipping method [closed]
- Custom Plugin Options Won’t Update
- Hide one specific woocoomerce product
- Woocommerce – Provide Associated Category Link for Product List Plugin [closed]
- get_shipping_methods() return empty rate
- Remove Products From Category
- want to show CMB2 metabox on woocommerce product data tab
- wp_schedule_single_event is set correctly but sometimes not fired
- Dynamic page generation upon purchase of a product
- Customise Grouped Product display in Woocommerce with custom column
- Change reminder email date to 14 days before
- Make a php array load faster
- How to make every image title equal to alt text(wordpress/woocommerce)?
- Create Woocommerce product without creating api credentials
- Pass Values in URL on WooCommerce Product Page
- Woocommerce place order update shipping price
- Add custom product data using javascript when add to cart button is clicked