• I am working on some customizations to the WC Fields Factory plugin for WooCommerce. One customization I have already done is to change the default upload directory for files uploaded via the product page. That one was easy enough to figure out and make work.

    Where I am getting stuck is trying to get an Order ID number from Woo before an item is added to the cart (or more aptly, as the item is added to the cart). Let me explain.

    I am a printing provider. I need to accept files uploaded by my customers with various metadata like print size, quantity, paper type and so on. For the files uploaded, I need to keep them segregated from other customers/orders (dropping them all into a single folder gets boring really fast). Order ID (numeric) seems the easiest way to segregate the files – create a subdir in the main upload folder that incorporates the order ID and place customer files in there.

    Is there some unique ID (Order ID, whatever) that can be tied directly to a customer as they are building up their order (uploading their files per product ordered) that can be obtained from Woo – even as the first product for an order is being added?

    Ideally, I need this unique ID to be available by the time process_file_upload() is called so that the proper folder for the files can be created as needed and the uploaded files placed in there.

    Thanks!

    Ron

    https://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Orders are not created until checkout, so this won’t be possible. You’ll need to use a unique hash or something based on the current user instead.

Viewing 1 replies (of 1 total)
  • The topic ‘Order ID before item added to cart’ is closed to new replies.