Not tested, but what if you use
WC()->cart->get_cart()
to retrieve the cart contents instead of the global $woocommerce object?
However, I believe the problem is that cart contents require the user’s session, and accessing it via cron won’t know who the user is. You might need to start querying the database directly through $wpdb in order to find this information outside of a specific user session.
Related Posts:
- How to check if woocommerce is activated in theme
- Woocommerce get selected shipping zone id for the current user
- Query WooCommerce orders grouped by several order statuses
- retrieve thumbnail from post ID of best selling product in category
- Display a selected custom product option in WooCommerce cart
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Automatically check the option “Enable stock management at product level” on product creation
- How to show order data by multiple ID?
- Problem with Woocommerce REST API Authentication
- Remove General Tab and Plugin Tab in Settings in Woocommerce
- WooCommerce – Display variation custom field value [closed]
- Woocommerce: Is it possible to overide the settings for allowing to purchase out of stock products [closed]
- Woocommerce HTML email option unavailable
- How to add SVG icon above product tab title
- How does WooCommerce ensure that a product doesn’t run out of stock during payment? [closed]
- How to change / delete product short description in Woocommerce
- How to trash multiple post/product programmatically
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- woocommerce – hide payment method in new order email
- Limiting woocommerce line_total decimal length
- Change the URL of an image from wp_get_attachment_image_src except in the frontpage
- woocommerce subscriptions – get expiration date [closed]
- Woocommerce hook run after an Order been created through REST API
- Get and insert order email address to the PHP template inside HTML text
- If no products are on sale – hide ID or class
- Woocommerce api: create product with images – bad request
- 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
- How wp-cron can run in background if PHP is single threaded?
- How can I pass a custom/dynamic product to the Woocommerce cart?
- WooCommerce custom product dimensions
- WordPress Woocommerce – Product Type [closed]
- Pagination for custom shop loop woocommerce
- How to get private property in parent class into extended class?
- Replace Woocommerce “add to cart” to be “Download” button [closed]
- Woocommerce Email attachments not working – file not being attached
- get_total () returns 0 – woocommerce [closed]
- Large WordPress CRON job
- email alert for product availability
- How to rename woocommerce-billing-fields
- How to display a custom product field value of a specific category on a Woo Commerce checkout page?
- Personalize checkout text
- Create a package of products as one Item in woocommerce?
- fetch woocommerce product with custom taxonomy
- After disabling WPML multi currency, the currency is still handled by the WPML
- Custom Taxonomy Select Menu: Setting default option value?
- How can i programmatically change the SKU of a product based on product variation?
- Execute PHP code only with specific user role
- Woocommerce Custom Meta Boxes- How to only display if they actually have content
- Add a custom WooCommerce settings tab with sections
- Display Sibling WooCommerce Product Categories on Archive Page
- Checking page before applying image restrictions while uploading
- How to sort WooCommerce products page by latest in-stock items first?
- WP_Query for woocommerce products with a pattern as a post_title
- WordPress Fresh Install Errors (Woocommerce specifically now)
- How to update ticket price programatically when adding to cart and checkout in woocommerce
- Woocommerce My acount page
- Woocommerce – Exclude variation attribute on specific variation
- Get WooCommerce products with similar SKU
- PHP function for horizontal Woocommerce thumbnails and badges
- Use CSS tag inside PHP code
- Setting up a cron job to auto update a custom field
- WooCommerce display price before add to cart [closed]
- Get the same SKU from woocommerce itself for simple and variable products
- How can I show how much water got saved on this order (making use of the number of items bought) on a thank-you-page?
- IF statement not working – Any suggestions?
- Woocommerce checkout page – custom field checkbox value into email
- Get x numbers of a woocommerce category products using Wp_Query
- Get field value and use as variable in php
- Set notification if is two product category in cart
- WooCommerce – template_redirect if is_checkout AND order has been paid?
- my hook or my function wont run in the cronjob
- Make WooCommerce product categories only show images on homepage
- ACF under category name in shop page [closed]
- WooCommerce Quantity in Dropdown menu instead of clasic [closed]
- Php cron job (wp-cron) not working
- WP_Query To Display Product Of Brand On Taxonomy Page
- Reverse Cross-Sells (WooCommerce)
- Hot to edit WooCOmmerce dashboard?
- WooCommerce subcategories help
- WooCommerce multiple custom fields code
- How to have more than one ID included in the exclude command?
- I was wondering if it’s possible to implement card.js on WordPress
- wp_query beginner
- WordPress using get_term to retreive slug not working as expected
- Can’t make product images clickable
- WooCommerce – Print Processing orders [closed]
- Hide cart when empty [closed]
- Cron job to call php to email last 24 hours posts
- WooCommerce Custom Pagination
- Order woo products, but first products must be with acf fields
- wordpress.org disallowing my plugin becuase of loading core files in cron cpanel file
- Warning: Attempt to read property “term_id” on int – Woocommerce
- Grabbing value of input field inside of array
- How to set variable to specific field when querying
- WooCommerce Checkout Cart [closed]
- Woocommerce – Include custom user meta in order ‘filter by registered customer’ Ajax search
- Change WooCommerce Order status from frontend form submitted data
- Woocommerce – add tracking code to another email template