i need a way to get the woocommerce-booking id to be exactly equal to the woocommerce order id?
I also want them to increment by 1 sequentially?
Unfortunately that can't be done. Bookings and Orders are both 'posts' so the ID's for both of them are saved in the same table in the database, and the ID's must be unique.
Related
I have a DDB table, 4 attributes, key (PK - a string), date (sort/range key), status, frequency.
I have multiple clients that will write to this table based on the 'key' and date value
I want to increment frequency every time a client makes a write.
Can I just use DynamoDBVersionAttribute on an int field and use this as a proxy for frequency?
I understand this is not meant for this use case, but I want to avoid having to first read and then write the item. Any thoughts?
Since you're already doing an update expression, just add an ADD action to increment the frequency by 1. The ADD action doesn't need to know the original value to increment it.
See the example from the docs here:
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.UpdateExpressions.html#Expressions.UpdateExpressions.SET.IncrementAndDecrement
I want to retrieve an order by its number (not order ID) or by a date.
Earlier I've tried to retrieve (with Postman) an order by its order_id, status or order_key - and it worked:
https://example.com/wp-json/wc/v1/orders?status=completed&consumer_key=ck_...&consumer_secret=cs_...
With the example above, it works correctly.
However, when I'm trying to use number, all of the orders are listed:
https://example.com/wp-json/wc/v1/orders?number=123&consumer_key=ck_...&consumer_secret=cs_...
I've tried also filter[number], the result is the same (all orders are listed):
https://example.com/wp-json/wc/v1/orders?filter[number]=123&consumer_key=ck_...&consumer_secret=cs_...
Question: Could you please explain how can I get order by order number (or a date) using Woocommerce REST API?
As per my understanding, you need to display orders in an ASC or DESC order based on the order number.
you can use orderby and order query string parameter like this to get the order by date https://localhost/wp-test/wp-json/wc/v3/orders?&orderby=date&order=asc&consumer_key=ck_b9f70548c7b676&consumer_secret=cs_10acfa5ab943eb6a0e
Generally order by date will provide you the result of an order by number too because the order placed on the latest date will have the latest order id as per WordPress until you modify from the admin side and vice-versa
Please let me know if I can help you further..
I would like to define a field, where there is a list of allowed values as well as give user the option to type it in. For example, I list a bunch of previous jobs that the applicant can have, plus have them pick other and fill it in as well.
Is it possible to do this with one field or do I need two fields where the user has to type it in? Is there a doc. or sample or tutorial I can look up? Thanks.
Here is a super simple Tags sample:
https://drive.google.com/open?id=0BxtQI4fTAVQqcUx4OUJfQ1JYV2c
To cover your exact use case you just need to:
Add logic to check if record already exists
1.1 If record doesn't exist, then create one
Create relation between records
If you don't care about duplicates in your database, then you can skip step 1 and always do 1.1 and 2.
im trying to change the order in which appear the groups fields, for example, i have a group field named "Header" but it appears at the end of the page editor, and the other groups field appears in different order that i want, so i want to change the order for have the same order that is presented in the page, in the html.
Thank for all
You need to set the Order No. for each field group. This is found on each field group edit page at the bottom. If you want the "header" first assign it 0 and then the subsequent groups something higher.
Order No. Field groups are created in order from lowest to highest
Change the Order No. works but not always work, in my case i had to change the order directly en the database. Checking the id post of the custom fields and order this in the table wp_usermeta in the meta-box-order
In a specific table I have a SortOrder integer field that tells my page in which order to display the data. There are sets of data in the this field (based on a CategoryID field), and each set will have its own ordering. Users can add/remove/update records in this table.
My question is what is the best way to manage this SortOrder field? I would like to "reseed" it everytime a record is deleted or updated. Is this something I should be using a trigger for? Or should my code handle it and manage the reseeding?
What I used to do is use only odd numbers in the SortOrder field so upon changing the order, I would add or subtract 3 from the current value of the modified item and then do a reseed (order the items again using odd number indexes). Also I used to reseed after every insert or delete.
All you really have to worry about is swapping any two fields. All new entries go to the end and i'm sure you've got a mechanism by which the user can change the order. The order change, move up or down, really is a swap with a neighboring field. All you really care about is that all the fields are sorted properly. Don't let a mathematical sense of aesthetic drive you into creating something overly complex. (You'll end up with holes in your sequence after deletes are made but that's OK. It's an internal sequence marker used for ORDER BY. the numbers don't need to be made contiguous.)