$_Post not available when user is created at submission
-
I’m saving additional order meta and order item meta from custom form fields on the checkout page upon order creation using
"woocommerce_checkout_update_order_meta"
for the order meta and"woocommerce_checkout_create_order_line_item"
for the addtional order item meta.
This approach works well when a) the user is logged in or b) users are guests (no account creation allowed). However, when a user is creating a new customer account while submitting an order, $_POST isn’t available at the hooks mentioned above for reasons I don’t understand (I assume they will have to do with the user creation process).For order meta, it’s possible to use the data provided at the hook to create the additional meta fields. However, for the line item meta, the data provided at the hook
"woocommerce_checkout_create_order_line_item"
doesn’t contain the additional fields that I want to add to the line items through the form on the checkout page.To me this implies that I either need to access $_POST at the above hook to create the additional line item meta or somehow add the required variables from $_POST to the cart using a hook that fires after the submission click but before the user creation and thus that still has access to $_POST.
Can you think of a hook to use? Thanks for any suggestions.
- The topic ‘$_Post not available when user is created at submission’ is closed to new replies.