Menu

Order Form for WooCommerce

Order Form for WooCommerce

Create simple order forms for your WooCommerce products

Filter hooks

Developers can customise the behaviour of the order form through filter hooks. There are many useful filter hooks supported by this plugin, and by WooCommerce itself.

Here’s some example code that uses these filter hooks:

orderform_woocommerce_empty_order_message

  • string $message — “Please select an item from the form”
  • return: string

Change the error message shown when an order is submitted without any products.

orderform_woocommerce_out_of_stock_msg

  • string $msg — the Out of Stock message
  • WC_Product $product — the WooCommerce product
  • array $attrs — the shortcode attributes for the order form
  • return: string

Change the out of stock message for a product.

orderform_woocommerce_form_attrs

  • array $attrs — the shortcode attributes for the order form
  • return: array

Modify the attributes passed to the shortcode.

orderform_woocommerce_form_redirect

  • string $redirect_url
  • string $submitredirect
  • return: string

Change the page that shows after submitting an order form.

orderform_woocommerce_products

  • array $products — the WooCommerce products in the order form
  • array $attrs — the shortcode attributes for the order form
  • return: array

Change the products selected for an order form.

orderform_woocommerce_products_by_category

  • array $categories — a hierarchical array of categories and associated products
  • array $products — the WooCommerce products in the order form
  • array $attrs — the shortcode attributes for the order form
  • return: array

Customise the categories and products selected for an order form.

orderform_woocommerce_product_category_list_separator

  • string $separator — defaults to “, “
  • array $products — the WooCommerce products in the order form
  • array $attrs — the shortcode attributes for the order form
  • return: string

Change the product category separator (normally a comma and space, “, “) when collating products into categories for the order-form-by-category template.

orderform_woocommerce_product_category_list

  • string $categories — the list of categories for the product
  • WC_Product $product — the WooCommerce product
  • array $attrs — the shortcode attributes for the order form
  • return: string

Change the list of categories for a product when collating products into categories for the order-form-by-category template.

orderform_woocommerce_adjust_product_price

  • string $price — the displayed product price
  • int $product_id — the product ID
  • return: string

Change the product price (e.g. for custom discounting).

orderform_woocommerce_item_variation_choose

  • string $label — the label for the empty select option
  • string $attr_name — the name of the variation attribute
  • WC_Product $product — the WooCommerce product
  • array $attrs — the shortcode attributes for the order form
  • return: string

Change the label on the empty select option for a variation select element.

orderform_woocommerce_order_form

  • string $html — the HTML content of the order form, including the wrapper div and form element
  • array $attrs — the shortcode attributes for the order form
  • return: string

Change the HTML for the order form.

orderform_woocommerce_product_row_template

  • string $template_name — the name of the product row template
  • WC_Product $product — the WooCommerce product
  • array $attrs — the shortcode attributes for the order form
  • return: string

Change the product row template that will be used to display a product in the order form.

orderform_woocommerce_classes

  • array $classes — an array of CSS class names
  • array $products — the WooCommerce products in the order form
  • array $attrs — the shortcode attributes for the order form
  • return: array

Change the CSS classes applied to the order form table.

orderform_woocommerce_responsive_css

  • bool $enabled — whether to enable the responsive CSS for this order form
  • array $products — the WooCommerce products in the order form
  • array $attrs — the shortcode attributes for the order form
  • return: bool

Enable or disable responsive CSS on an order form.

orderform_woocommerce_responsive_width

  • string $width — a valid CSS width value, e.g. “770px”
  • return: string

Change the width at which responsive CSS activates.