WooCommerce Order Dropdown field for Contact Form 7
Add WooCommerce Orders Dropdown fields to the popular Contact Form 7 plugin. Add Woocommerce Orders Dropdown to the popular Contact Form 7 plugin. This field creates a drop down of current user’s orders. Contact Form7 form will be more useful to use for support purpose. You just have to install this plugin to add a new field type in Contact form 7 fields.
Install the plugin like any other 3rd party wordpress plugin or in short, download the zip from our site, go
to plugin manager and click “Add New”, next window click “Upload Plugin”. Now browse the
zip file you downloaded and install, activate.
Using this plugin
After you activate this plugin in contact form7 any form edit view you will see new button/field type like this(click
to see image). On click of “WooCommerce Order Dropdown” it will open a popup to configure
the field, you will get two shortcode one to use in the form editor and other to use for email body, the
next tab called “Mail”.
Here is an example how the shortcode looks for form [wooorders wooorders-XYX] where xyz
will be any digit and for email body [wooorders-xyz] where xyz will be the same digit you found for same
form field. So, up to this setup what will happen is it will render a products as dropdown in frontend in
the form for any visitor. After user submits any form in email alert admin will get the product id if user
select any product from the dropdown.
Showing Order id as link in email in place of only just order id
So, in email user or admin (depends on how you configure the email body for admin alert or visitor or who
ever gets email) gets order id which needs further search in backend products listing to understand which
order and same way for customer in frontend. To ease this, we have another shortcode which is not related with contact form 7 but can be used in
the email body. The shortcode is
[cbxcf7wooporder_url id="Order Id here"]
Order Status(New Field Attribute ‘status’)
Now order status can be set in the field. For multiple order status need to put using _ (underscore).
Example field: [wooorders wooorders-588 status:wc-completed_wc-cancelled]
WooCommerce built-in status are: wc-pending, wc-processing, wc-on-hold, wc-completed, wc-cancelled, wc-refunded, wc-failed
To use all status, don’t use the attribute ‘status’
now if we use the id that is selected from form submit as input for for this shortcode then the combined
shortcode will be like this, suppose the product id xyz is from form’s submission.
If we use this shortcode
[cbxcf7wooporder_url id="[wooorders-xyz]"] in email template body in contact
form7 then in email admin will get order url (hyperlink)
Shortcode “cbxwooproduct_url” has more parameters or attributes. See bellow the possible attributes and their
|Attribute Name||Default Value||Possible Values & Usages|
|id||empty or null, if no id given this shortcode returns nothing.||any woocommerce order id(here for this plugin we have explained how woo order dropdown field shortcode can be used as input for order id), see we already explained the example before|
|rich||1||1 = rich hyperlink(needs for html email), 0 = text based link(used for plain text email). Our shortcode can not understand if email is html or plaintext, so, you need to configure as you configure.|
|edit||0||0 = order front end link(good to use for visitor email alert), 1 = order backend edit link(practically used for admin email alert)|