-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to return order custom field data in AJAX response #1002
Comments
For context, you might want to read the various recent issues on this: And this is, I think, the event you can use to force particular custom fields to be added: |
I believe those links only apply to retrieving product custom fields. What I am looking for is a similar system to include order custom field data in the AJAX response. |
Right you are! Silly me, read that too quickly, sorry for the noise. A similar approach would make sense here... |
Hey @elivz , I found this issue and I have a similar use case. I am wondering how you structured your ajax post call to get it to return custom order field data? |
I didn't. Looks like @lukeholder added a new |
Ok great. No problem. I figured out another solution in the meantime. Thanks! |
Description
Currently, the JSON representation of a cart (either in the response to an AJAX call or via
craft.commerce.orders.cartArray(craft.commerce.carts.cart)
does not include any Order Fields that have been set up. I assume this is for performance reasons, but there are a lot of cases where one might want/need that data. For example, I am creating an AJAX-powered cart, and need to be able to retrieve and save custom field data. Saving works fine (via thecommerce/cart/update-cart
action, but there appears to be no way to get that data back out, short of creating a custom endpoint. Am I missing something?If you prefer not to include that data by default, maybe you could add an event to modify the cart data, similar to how we can use
EVENT_AFTER_CAPTURE_PRODUCT_SNAPSHOT
to add data to the line item snapshot?The text was updated successfully, but these errors were encountered: