Skip to content
Advertisement

Add and manage Product custom upload field in Woocommerce 3

I am trying to add a file upload along with radio inputs in a custom woocommerce page; where all the products are showing in a list view.

The Custom Page CODE:

JavaScript

For variations to show in list view as different items/products in funtions.php

JavaScript

I am able to add the radio values to cart & order but not able to do anything with file upload.

Please take a look:

JavaScript

Here’s the AJAX PHP

JavaScript

And here’s the edited js

JavaScript

This page is only accessible to certain users, so it has different input fields, price than the single product page counterpart. Client don’t like this page to be refreshed so I had to add AJAX, with the little knowledge I have. Now it’s getting more complicated so please help me out.

Advertisement

Answer

Update 2021Still works perfectly on last WooCommerce version (5.1.x).

In your actual code, there is many mistakes as:

  • Repetitive hooked functions using the same hook, that need to be merged instead.
  • Deprecated hooked functions.
  • Not useful or not needed hooked functions.
  • Wrong or missing code related to file upload

Here is your revisited code (much more lighter, compact and complete):

JavaScript

This code goes in functions.php file of your active child theme (or active theme).

Tested in Woocommerce version 3.4.x and working with normal products (from all types)


Frontend: orders display (and email notifications):

enter image description here

Backend (Admin): Display on orders edit pages:

enter image description here

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement