First of all it’s not clear why getting all products in one go seems to not be an option if you have control on the API
you can add a custom endpoint and write your query to get all the products ( maybe in status “publish”)
something like :
global $wpdb;
$Q="SELECT * FROM ".$wpdb->prefix."posts WHERE post_type="product" AND post_status="publish"";
$completeProductList = $wpdb->get_results($Q);
return new WP_REST_Response($completeProductList, 200);
should work.
Second : without testing your function I think that
if (count($completeProductList < 1))
should be if (count($completeProductList) < 1)
your code is counting a boolean instead of a Countable interface, maybe it’s not the final solution but this looks like a bug
Related Posts:
- Use wc_enqueue_js only on specific pages – nested add_action
- Problem with Woocommerce REST API Authentication
- wordpress custom endpoint multiple params
- Continue execution after WP REST API response
- using woocommerce_template_single_add_to_cart in shop-loop – javascript issues [closed]
- woocommerce subscriptions – get expiration date [closed]
- Automated Cart Update With Alert Box Each Time
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- Woocommerce hook run after an Order been created through REST API
- what is the best practice to add new field to an api route
- Woocommerce api: create product with images – bad request
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- How to auto fetch customer details in Woocommerce in checkout page
- I want to add custom add to cart link [closed]
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- Building a REST API for your web app exposes primary keys of DB records?
- Change product_base programmatically
- Can a plugin redirect product page based on IF condition?
- Cant register rest routs from class instance
- WC_Customer delete function returns error
- Validate and Sanitize WP REST API Request using WP JSON Schema?
- WordPress WP_Query without query GET parameters
- Where to copy woocommerce files to in my custom theme to avoid editing the core plugin?
- custom post type with role Vendor
- Woocommerce custom Plugin in wordpress [closed]
- no_rest_route error on custom routes
- Add a custom WooCommerce settings tab with sections
- Flatten Responses returned via WP REST API via WP_Error for obfuscation
- Payment field disappears on custom Paypal plugin
- I am having errors with checkout on wordpress
- product_type_options get saved value [closed]
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- WooCommerce REST API AJAX Auth – 401 response
- How to import woocommerce custom fields data into another site?
- get Woocommerce product format json for WP_Query
- How do I remove an action hook inside a class that is called by another class?
- Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint
- How keep woocommerce users separeted in multisite install and keep admins on network
- Properly process a custom WP REST API request (Authenticate, Authorize + Validate)?
- Custom field fetch error on woocommerce pdf invoice
- How to pass and validate nonce in custom REST routes
- Query posts by custom taxonomy slug in WP REST API?
- oneOf JSON Schema validation not properly working for custom post meta value?
- Authenticate + Authorize WP REST API request before built-in WP JSON Schema Payload Validation?
- Woocommerce Convert existing order to the cart
- WordPress REST API – Custom field not added to pages
- How to add product in woocommerce with php code [closed]
- Using register_activation_hook in classes
- Creating custom Woocommerce attribute taxonomies from a plugin
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- How to get the original price of the product in woocommerce?
- How to Remove a Filter from the Admin List Table?
- Remove commas from WooCommerce checkout addresses fields
- Making Quote Plugin more efficient
- Writing scripts using WordPress / WooCommerce classes?
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- How to make custom total price reactive in navigation
- Change description on specific WooCommerce product status change
- How to add a second ‘place order’ button in WooCommerce [closed]
- Instantiate class to be available to all plugin functions
- WP nonce invalid
- Woocommerce redirect thankyou page based on product ID doesn’t empty Cart
- tracking number field in Woocommerce order [closed]
- Add a product to checkout via form
- 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
- My new button is in the wrong place
- How to obtain the current website URL in my theme?
- Plugin Generate Unexpected output during activation
- Function returns text instead of html [closed]
- Undefined method class::construct() when creating a plugin
- WordPress REST API register_rest_route give a 500 error
- How to display SQL query that ran in WC_Order_Query?
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- woocommerce wc_create_order(); is creating multiple orders instead of one?
- Using admin-post.php for admin form but it directs me to admin-post.php white screen
- How can I display Custom Post type Custom Columns and its Content in a Dashboard Widget?
- How to restrict shipping zone in a specific interval time
- Hide specific product from Woocommerce if the logged-in user has already enrolled into the course
- Convert a column of a table containing an Array as response in HTML
- Create ACF Checkbox to get all ACF Values from Parent Page
- Display custom field value in woocommerce variable product via jQurey
- Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)
- Billing detail page doesn’t work after I’ve changed the order of the Woocommerce navigation
- get orders of today’s date
- File is executed twice if plugin is activating
- Add to cart quantity dynamic
- Woocommerce – get daily sales meta
- Custom woocommerce payment gateway – Form
- i want add conditional for add category in wordpress
- Woocommerce remove menu item on myaccount dashboard
- how to display woocomerce description of each category in wordpress? [closed]
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- woocommerce plugin bugs
- Woocommerce Price Text
- See output of a sql query while plugin installation in wordpress
- Why this plugin is not working?
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- using custom pages for myaccount in woocommerce