Integrating the FES Submission Form with Various Download Settings

Frontend Submissions (FES) is one of the most popular extensions for Easy Digital Downloads because it gives store owners the ability to accept product submissions from vendors. That means customers will benefit from not only the products of the store owner, but also the surrounding community.

The nature of this functionality, however, can present a challenge for store owners as they walk a fine line between vendor control over submitted products versus their own control.

Should vendors be able to set their own prices? How about the file download limit, who sets the value? These questions and many others are what make each FES installation unique.

In this article, I am going to show you how to leverage FES’s functionality to give your vendors the exact amount of control you want them to have.

Download Meta Data

The first thing we need to cover is how information is tied directly to download entries (individual products in your store).

We’ll use one of the basic EDD download settings as an example. If you go to create a new download entry or edit an existing one, you will see a “Download Settings” meta box in the sidebar of the edit screen.

download-settings

Let’s say you, the store owner, had a unique stocking system for your products and it was important that each download entry on your site have a specific SKU (stock keeping unit). Unless your vendors have the ability to create SKU values when submitting their products, you will have to set them yourself for each product. With enough scenarios like that, it would eventually begin to feel like giving vendors the ability to submit products was creating more work for you instead of the other way around.

The SKU setting shown in the screenshot above is a setting that does not have a ready-made FES field that you can place in your FES Submission Form. However, there is a way for your vendors to use the setting.

In WordPress, single Post or Page entries can have what is called “meta data” connected to them. Meta data is nothing more than stored information that is connected directly to that entry. And because EDD’s Downloads are essentially the same thing as Posts and Pages, they also support meta data.

Meta data is organized by unique identifiers called meta keys, that way each piece of information can be managed by itself. In this particular case, the meta key for the SKU setting is edd_sku.

As the store owner creating a new product, all you have to do to save a value to the edd_sku download meta is type your value into the text field provided. Likewise, you can edit a vendor’s product submission to input an SKU value if you do not give them the ability to do so themselves.

With this understanding of meta data, meta keys, and basic knowledge of how to add fields the FES Submission Form, I will show you how to give your vendors more control and reduce your workload.

Submission Form Field Meta Keys

extensions2Creating your Submission Form in FES is fairly simple. All you have to do is add the fields you want your vendors to complete or at least have the option to complete.

Fields that your products will require, like the title and description, do not require much configuration and are automatically included in the Submission Form.

Other fields like “Download Prices and Files” are built to serve a specific purpose. So even though it is not a required field by default, the settings are very specific to the purpose of the field.

The majority of fields, however, are more like tools based on the field type, not the field purpose. This means that a general Text field can be used in any way that you see fit. In my example, a Text field is what we are going to use to allow vendors to set their own SKU value.

Keeping in mind what you’ve learned about meta data, and the fact that each piece of meta data has a unique meta key for identification, what we have to do is connect our FES field directly to the meta key we want the vendors to control… and it’s very easy to do.

sku-field

As you can see in the above image, Text fields have very general settings and fields. In this case, the most important field is “Meta Key.” Because I set it to match the meta key for the actual setting in EDD, we are now giving vendors a field that directly edits the SKU setting for the product.

With this field saved in the submission form and required, store owners never have to worry about setting the SKU value or giving vendors back-end access to the site in order to set it themselves. They can do it directly from the FES vendor dashboard when submitting or editing their own products. Awesome.

Using This Information In The Real World

As simple as this sounds, you will still have to do a little bit of homework to get it set up in each case. Meta keys are not just displayed next to the settings on an Add/Edit Download page. So finding them can be a challenge.

One easy way to find the meta key for a simple setting is to use your browser’s inspector. By inspecting the actual field element of the setting you need to give your vendors access to, you can oftentimes see the meta key value in the “name” attribute of the input element that controls the setting.

inspect-sku

In the image above, you can see that “edd_sku” is the meta key needed to connect your submission form input field to that setting.

This may be a little more difficult in other cases. First, it must be understood that some settings are just too complex to control from an FES Submission Form. Likewise, some extensions are already integrated with FES and create their own FES submission form fields for the settings they add to the Add/Edit Download screen.

When the aforementioned does not apply but you still do not have the meta key you need, it’s time to dig into the code. There’s no limit to the amount of meta data that can be added to a download through settings. So if you have a number of EDD extensions installed, or perhaps other plugins that have nothing to do with EDD, you may have more settings to consider.

What you have to do here is look at the source code for the plugin/script/etc. that adds the setting to the download. Every setting that receives and saves input from the user (you) on that Add/Edit Download screen deals WordPress post meta functions like add_post_meta() or update_post_meta(). Both of these functions can be used to create a new setting and both of them require that you specify the meta key for that setting. So if you can find these functions in the code, you can find the meta keys.

The basic structure of the code will be very similar to this:

add_post_meta( $post_id, $meta_key, $meta_value, $unique );

In that code, $meta_key represents the value you will need for your FES field meta key.

Note: In some unique cases, the code can be a little more complex and include things like PHP variables as the meta key. If that’s the case, it may be time to start looking for a custom developer.

Handy Download Setting Meta Keys

There are a few default EDD settings that are not connected to FES form fields. Below are the names of those settings and their corresponding meta keys that can be used in appropriate FES form fields.

File Download Limit_edd_download_limit
Download Notesedd_product_notes
Output Purchase Button_edd_hide_purchase_link

The Takeaway

As you’ve probably noticed, there is no one snippet of code that will satisfy all of your needs here. Even more, FES simply can’t be integrated with every single setting on your site. But a basic understanding of download meta data, meta keys, and FES fields can take you a long way.

Think carefully about what level of control your store vendors need and work to streamline the process as much as possible to improve user experience. Vendors are considered store owners within your marketplace. Implementing what you’ve learned in this article benefits both ends of the partnership.

Comments

Thomas

Finally! It was about time for this extension.

I haven’t used the extension yet, but just from reading this post, I would say rather than having to dig through the source code or EDD codex, I am sure many EDD store owners, especially the not so code-savvy ones, would appreciate to see a dropdown with all EDD meta keys instead of the empty meta key text field. Non-EDD/custom meta keys could still be added the way you currently provide the option, using a simply text field. But additionally, not as the default way to setup this sort of form field.

Reply

Thank you for the feedback, that’s an excellent idea!

Reply

thank you information

Reply
Muhammad

Hi Sean.

I don’t see the “Accounting Options” anywhere on a product’s page.

Am I missing something here?

Thanks,
Muhammad

Reply

Hi, Muhammad.

Go to Downloads -> Settings -> Misc (tab) -> Accounting Settings (section) to “Enable SKU Entry” which will make the Account Options section show up on the Edit/Add Download screen.

Reply
Muhammad Fawwaz bin Senin

Thanks Sean for the quick response.

Will this then remove the need for the Purchase Limits extension?

Reply

No it wouldn’t. SKUs are simply for tracking inventory in a strategic manner. Making decisions about inventory based on SKUs would take custom development and would be along the same lines as what Purchase Limits already does (though it doesn’t require SKUs to function).

Reply

Leave a Reply

Your email address will not be published. If you need technical assistance, please open a support ticket.