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:
- Adding product permalink on admin order page throwing error
- Make WooCommerce product categories only show images on homepage
- How do I remove an action hook inside a class that is called by another class?
- How to create loop inside wordpress function?
- ACF under category name in shop page [closed]
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- Add Product Permalink in woocommerce admin order page
- Add Shortcode to ::before class
- Cron not sending wp-mail()
- How to override WooCommerce Order Item Meta with data from Cart?
- sessionStorage saves input value in browser but it is not loaded in the form field
- Woocommerce textarea format ignored
- How to auto-generate random numbers in username?
- i want add conditional for add category in wordpress
- Remove generated category and tag class names from woocommerce product & blog listings markup
- Adding a widget under an ‘Add to Cart’ button through a PHP snippet
- WooCommerce Quantity in Dropdown menu instead of clasic [closed]
- Php cron job (wp-cron) not working
- 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
- WooCommerce get products based on the taxonomy
- WP_Query To Display Product Of Brand On Taxonomy Page
- Woocommerce Add custom “Add to cart button” in single page with tags
- Reverse Cross-Sells (WooCommerce)
- Woocommerce remove menu item on myaccount dashboard
- How can i style “echo apply_filters”
- Hot to edit WooCOmmerce dashboard?
- How to echo a PHP code into WooCommerce variation product?
- How can I add another row to the total field in WooCoommerce cart, checkout and recipe mail?
- WooCommerce subcategories help
- Get Billing Email from WooCommece Checkout and Pass to Fullstory JS
- Woocommerce custom attributes list help
- WooCommerce multiple custom fields code
- Get all woocommerce product names with price and show using core php
- Search function not working
- loop to return tags in woocommerce in alphabetical order?
- Woocommerce Related Product by 2 taxonomy
- append data to mysql table via submit button coded in php – not working
- New database entry to trigger runing PHP/SQL query through link with token, without logging into the website
- random woocommerce categories are not showing when count enabled?
- Add custom ID attribute to all woocommerce products on archive pages
- Put a span class in the shortened product title
- How to properly create multiple conditions to redirect users roles to different pages
- Add missing alt tag to featured images for “storefront” theme
- WooCommerce – Add Shipping class below each product in Shopping Cart page
- Hide price excluding tax when price is empty
- How to limit functionality of a woocommerce plugin to only certain user role?
- WooCommerce Custom Tab with ACF Repeater Field
- PHP – Woocommerce 3.2 Add variable shipping insurance with multiple “else if ” conditions
- How can i put php code on the wordpress page?
- Sort WooCommerce data with WP-CRON?
- Woocommerce variable products are being added to the card on the homepage (ajax)
- Display specific main Sub Nav on Woocommerce product pages
- How to have more than one ID included in the exclude command?
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- I was wondering if it’s possible to implement card.js on WordPress
- wp_query beginner
- Global filter not working
- how to display woocomerce description of each category in wordpress? [closed]
- Use PHP code in Menu Admin Section
- Woocommerce variation with radio button + price
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- Display text of price (minus 20%) on every product page in a sentence.
- WooCommerce – Add product category below product price [closed]
- How to detect if a revision was made by woocommerce or wordpress?
- Need Quick Help With Product Category Page
- WooCommerce remove_action and add_action [closed]
- woocommerce plugin bugs
- Woocommerce custom field on emails outputs ‘Array’
- How do I prevent a folder from reappearing in my home directory?
- Display product attributes for current product
- jQuery doesn’t work in my php snippet
- Adding my own custom template page but got white page
- Getting the date_diff function return the difference in days
- WordPress using get_term to retreive slug not working as expected
- Can’t make product images clickable
- How to remove image on single product and get product to span page?
- WooCommerce – Print Processing orders [closed]
- Use WP_Query Data In Cookie
- Woocommerce Price Text
- Hide cart when empty [closed]
- Need some help with tweaking a code for woocommerce [closed]
- Cron job to call php to email last 24 hours posts
- How does one programmatically manage posts from a external php script?
- How to add custom checkout field in user details mail template
- WooCommerce Custom Pagination
- How to set up and use a custom upload directory for post type ‘product’
- How to get the rating value of each comment
- Add specific phrase after every product title including the discounted price? [closed]
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- How to add margin underneath woocommerce total price amount -> productpages
- Adding placeholder text field to woocommerce checkout [closed]
- Display Sale Price Before Regular Price (WooCommerce)
- wc_add_notice not working on cart page
- Order woo products, but first products must be with acf fields
- How keep woocommerce users separeted in multisite install and keep admins on network
- ACF | WooCommerce | Theme Development | How to include a /template-part/ that makes use of ACF’s on a custom WooCommerce homepage?
- Setting WooCommerce currency programmatically
- Woocommerce – Shipping tax class based on cart items not using the highest tax available