Menu

Order Form for WooCommerce

Order Form for WooCommerce

Create responsive 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:

  1. 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).

  2. 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.

  3. 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.

  4. orderform_woocommerce_form_attrs

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

    Modify the attributes passed to the shortcode.

  5. orderform_woocommerce_form_redirect

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

    Change the page that shows after submitting an order form.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

  11. orderform_woocommerce_product_group_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 group separator (normally a comma and space, “, ”) when collating products into categories for the order-form-by-category template.

  12. orderform_woocommerce_product_is_variable

    • bool $is_variable
    • WC_Product $product
    • return: bool

    Change whether a product is treated as a variable product or a simple product.

  13. 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.

  14. 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.

  15. 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.

  16. orderform_woocommerce_products_grouped

    • array $groups — 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 groups and products selected for an order form.

  17. 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.

  18. orderform_woocommerce_responsive_width

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

    Change the width at which responsive CSS activates.

  19. orderform_woocommerce_responsive_width_buttons_desktop

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

    Change the minimum breakpoint for grid buttons CSS on desktop displays.

  20. orderform_woocommerce_responsive_width_buttons_mobile

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

    Change the maximum breakpoint for grid buttons CSS on mobile displays.

  21. orderform_woocommerce_responsive_width_grid_desktop

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

    Change the minimum breakpoint for responsive CSS grids on desktop.

  22. orderform_woocommerce_responsive_width_grid_mobile

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

    Change the maximum breakpoint for responsive CSS grids on mobile.