Data Stores provide a layer of abstraction between the working WC_Data object and the information stored in the database. In understanding how they work, you’ll know what your objects are doing when they create, load, save, and delete; and how to customize these behaviors. In this topic, we’ll cover:
WC_Data object method | Data Store method |
---|---|
__construct($id | $object) | read($data) |
save() | create($data) update($data) |
delete($force_delete) | delete($data, $args) |
read_meta_data() | read_meta($data) |
save_meta_data() |
delete_meta($data, $meta) add_meta($data, $meta) update_meta($data,$meta) The data_store uses WC_Meta_Data to assess which methods are necessary and minimize database transactions |
Structure of the wc_product_meta_lookup table.
Now that you know the interfaces that define data stores, and how the data store methods map to the WC_Data methods, you should feel more confident in your ability to navigate transactions between WC_Data object and the database. These two concepts are the keys to creating your own data stores, and fully customizing a WC_Object’s behavior.
Next, we’ll take a quick tour of each of the WC_Data families.
But first, check your knowledge.
Hint: You can use CTRL+Shift+F to quickly search the slides for information.
0 of 3 Questions completed
Questions:
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
0 of 3 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
WC_Data_Store_WP is a…
Data Stores receive what argument for all standard methods?
Lookup Tables Are…