0

Hi there i want to achieve this functionality and i want ideas. I have one custom form in front end and a user can fill this form and upload a custom post type but i want this steps.

User select a specific product i change the buy button with a button to send it in my custom form when user fill the form i want to send it in the checkout to buy the product and submit my custom form?

is it possible to succeed in such an operation?

2
  • are you asking this for a custom built product system or for a site built using a plugin such as WooCommerce? 3rd party plugin dev support questions are off topic here. This is not a place to get help with 3rd party ECommerce plugins and themes.
    – Tom J Nowell
    Oct 11, 2021 at 10:57
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Oct 11, 2021 at 12:34

1 Answer 1

0

If you are you using WooCommerce, you can use the "woocommerce_before_thankyou" hook to achieve this.

In frontend you can create a custom AJAX action to upload all form data and append the WooCommerce product ID (use WC()->cart->add_to_cart()) and your own post type logic (maybe you can add this post as draft and store the post ID in SESSION or transient API to publish when user completes the order [using "woocommerce_before_thankyou" hook]).

2
  • What about transient api? I store the form values in set_transient and when button complete checkout clicked get_transient and in thank you page delete transient? Oct 11, 2021 at 12:28
  • Yes, you can use transient too. Oct 11, 2021 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.