mic365
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Categories order in REST API endpointLook it up on Google. I think there are even videos that show you how to do it.
https://www.google.com/search?q=how+to+write+wp+hooksGood luck 🙂
mic.Forum: Plugins
In reply to: [WooCommerce] Categories ordering not working on REST API on 3.6.3We ended up hooking
woocommerce_rest_product_cat_queryand setting$prepared_args['menu_order'] = 1;, since you can not pass this parameter on the url.From my point of view it’s a bug on
wc_change_get_terms_defaults— I’d expect the default sort not to be by name if the categories were manually ordered on the backend.Other than this we found 3.6.x to be a great improvement, especially in terms of speed over larger data sets. Great job 👍
Forum: Plugins
In reply to: [WooCommerce] Categories ordering not working on REST API on 3.6.3Hi Remi, do you happen to have any updates on this?
Thanks for the help,
Mickey.Forum: Plugins
In reply to: [WooCommerce] Categories ordering not working on REST API on 3.6.3Got you.
In our case we need the categories as were ordered via the back end so there is no specific field we can supply to the
order_by. I believe we’d need theorderfromwp_termmeta. Can that be done via the url as well?Thanks for the help 👍
Mickey.Forum: Plugins
In reply to: [WooCommerce] Categories ordering not working on REST API on 3.6.3I’m not sure I understand you.
Do you mean we should add a plugin that alters
get_the_term_listbehavior? Generally we prefer not to interfere with your code.- This reply was modified 7 years ago by mic365.
Forum: Plugins
In reply to: [WooCommerce] Categories ordering not working on REST API on 3.6.3I apologize for not being clear, the problem on both cases is the same and happens upon upgrading, hence my thought there may be a mutual cause. I’ll focus on my case.
Problem:
After ordering the categories on the back end, if you issue a categories request to the REST API, the categories are returned ordered alphabetically.
Way to reproduce:
- Install a fresh WP using wp cli.
- Install WC plugin using wp cli.
- Define several categories on the backend and order them, not in an alphabetical order.
- Issue a categories request to the REST API (e.g. https://domain.com/wp-json/wc/v2/products/categories?consumer_key=ck_123&consumer_secret=cs_123)
- Problem: the categories are returned in an alphabetical ordered.
Environment:
$ vagrant --version Vagrant 2.2.4 $ cat Vagrantfile | grep config.vm.box config.vm.box = "johannesHome/bitnami-wordpress" # inside vagrant guest os $ uname -a Linux pc-test 3.16.0-4-amd64 #1 SMP Debian 3.16.51-2 (2017-12-03) x86_64 GNU/Linux $ wp core version 5.2 $ wp plugin status woocommerce Plugin woocommerce details: Name: WooCommerce Status: Active Version: 3.6.3 Author: Automattic Description: An eCommerce toolkit that helps you sell anything. Beautifully.Thanks,
Mickey.