Answer the question
In order to leave comments, you need to log in
Woocommerce how to add data from custom product fields to cart and order?
Good day! There was a need to add a small gallery to the product, with the ability to choose product color options. That is, pictures on which all this will be displayed. I did not find this in the proposed woocommrce functionality, only text fields can be added there! I found a manual for creating custom fields
www.remicorson.com/mastering-woocommerce-products-...
everything is fine, I did it, pictures in the admin panel are selected in the product card. But when adding to the cart and in the order, they are not visible. That is, it is impossible to understand which color was chosen.
How can I add this data from the fields to the cart and order? Maybe someone faced similar? Thank you!
Answer the question
In order to leave comments, you need to log in
The cart and order contain order-items. Outwardly, they look like products. But at the data level, they are stored in other tables. At the time of placing the product in the basket and then in the order, the data can be changed. Any. Be it price, title or meta fields.
I'm too lazy to look for a specific hook. But he definitely is.
This plugin works with this hook https://woocommerce.com/products/product-add-ons/ - it changes the price of the product through options. The same method can be used to replace any metafield.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question