Turns out that I was in the incorrect namespace. A new woocommerce cart can be instantiated by
$cart = new WC_Cart();
assuming you’re in the same namespace as the cart, but if you are in a different namespace and suffering the problem I had with my original question, you would change it to:
$cart = new /WC_Cart();
As the / means to check the standard namespace, the same namespace the WC_Cart was declared in.
Related Posts:
- Saving data only when payment is successful
- Fetching users data from REST API
- Automatically check “Enable stock management at product level” to the existing products?
- Change (replace) word in metabox
- how to make settings page for woocommerce plugin?
- Change hook to add_action in a plugin class
- redirect to a custom page
- wordpress plugin translation not working
- Woocommerce categories displayed on every category and shopping page
- Allow vendors on a WordPress site to pick from a gallery of pre-selected images when choosing product’s featured image
- Hide ‘add to cart’ button for some products [duplicate]
- 504 Timeout gateway when trying to pay for an order in Woocommerce. What else can I do?
- Change pricing in Woocommerce based on Category and Product [closed]
- woocommerce product search based only title
- Template conflict with WC Payment Method
- Many to many relationship for variable products
- Need woocommerce function for getting cart list with items
- WPNeo Stripe connect does not work
- Payment failed but order is placed on wp site
- How to change the product short description for each product with PHP?
- Adding/ Removing actions for plugins
- Get value from an input field and pass into update_meta_data as $meta_value
- Help needed with woocommerce (wc stripe) filter
- Widget logic using woocommerce product category
- Change value of Points earned in product data
- Problem with conditional woocommerce custom checkout field
- Unable to sync woocommerce variations
- WordPress Theme Conflict With Plugin
- How to Save settings of custom tab product page in admin side in a database?
- change product image url in widgets & shop page
- How woo-commerce store Product Data value in DB?
- Not getting result using ajax on wordpress
- How to allow customers to input a text as a product variation *and* charge per character?
- woocommerce blank page after clicking add to cart [closed]
- Which WordPress version to use for improved plugin compatibility? [closed]
- Run one-time script calling plugin functions
- Woocommerce: deleted single-product.php, everything still works. How is it possible?
- Holding 2 wp_user in the same action (to update billing_email when user_email is updated)
- Woocommerce Bookings – Resource needs to be allocated for part of the booking duration, not the whole booking
- Unable to show 4 products in a row
- Sort Reviews/Ratings by date on Woocommerce
- Move related products after product summary? [closed]
- Add A Button to WooCommerce Product Page
- WooCommerce doesn’t show UK countries in the shipping options [closed]
- Woocommerce quick checkout form [closed]
- Woocommerce Large Variations Shows Out of Stock Items [closed]
- Turning Existing Eccommerce Site into Multi-SIte
- How ACF Advanced Custom Field works with Woocommerce Single Product [closed]
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- The plugin generated xxx characters of unexpected output during activation
- WooCommerce custom query and paging: Not Found error
- WooCommerce & WooCommerce Shopee Intergration
- How to execute init or woocommerce_init only for checkout page
- WP Customer Reviews call short code on another page [closed]
- Trying to disable all notifications except for one on woocommerce checkout page with css [closed]
- Woocommerce – Product Description heading [closed]
- Need help saving input fields for Security Deposit plugin in WC Vendors page
- Visual Composer Data Source?
- Send Processing Order Email from custom payment plugin
- Why does theme need woocommerce to show images / content on front page?
- Woocommerce disable checkout on specific day
- Populate Woocommerce order notes with custom field value
- Woocommerce Product Add-ons – Auto-select first option
- how do I solve Installation failed: There has been a critical error on your website
- How to add plus minus button on Input Quantity box Woocommerce? [closed]
- Hook for single product thumbnail
- WooCommerce product prices not showing up correctly [closed]
- Woocommerce resize existing product images
- Am I allowed to resell WordPress Premium Plugins under GPL? [closed]
- Woocommerce where to set the Price Suffix [closed]
- Is there a method or plugin to download my products in WooCommerce?
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- Translate text for empty product
- woocommerce show cities state as dropdown list
- which plugin is this? [closed]
- Adding a script & php to functions.php
- Override the plugin class and function
- How to add a text in the checkout page woocomerce?
- Predefine Product Variations for specific custom product type [closed]
- Shortcode inside a redirect [closed]
- Woocommerce Product Page Collapsible Box Using CSS
- Display out of stock products in WooCommerce [closed]
- Console errors after WordPress Update 6.1
- ‘Active lotteries’ only custom query for woocommerce lottery plugin and elementor
- Create Custom Coupon Type
- How to create a “plugin” or “block” that can manipulate WordPress DOM in frontend?
- Update acf field in woocommerce orders
- How can I make a quotation engine like this website in WooCommerce?
- I want to set a different banner for each product in the woocommerce plugin on my wordpress site
- Add different sizes packaging boxes to orders plugin
- How to show image caption in Woocommerce gallery
- Template selector for woocommerce product
- How to add product thumbnail on orders list on backend?
- how to add meta for order in woocommerce
- How to add a static image inbetween the product tiles on main shoppage woocommerce?
- wp_options Table keeps growing
- WooCommerce REST API aborts connection [closed]
- Plugin Icon does not work correctly
- Product customizing quiz – quiz adding products to the cart
- I want create woocommerec match products columns