WooCommerce Code Reference

WC_Admin_Meta_Boxes

WC_Admin_Meta_Boxes.

Table of Contents

ERROR_STORE  = 'woocommerce_meta_box_errors'
Name of the option used to store errors to be displayed at the next suitable opportunity.
$meta_box_errors  : array<string|int, mixed>
Meta box error messages.
$saved_meta_boxes  : bool
Is meta boxes saved once?
__construct()  : mixed
Constructor.
add_error()  : mixed
Add an error message.
add_meta_boxes()  : mixed
Add WC Meta boxes.
add_product_boxes_sort_order()  : mixed
Add default sort order for meta boxes on product page.
append_to_error_store()  : mixed
If additional errors have been added in the current request (ie, via the add_error() method) then they will be added to the persistent error store via the Options API.
output_errors()  : mixed
Show any stored error messages.
remove_block_templates()  : array<string|int, string>
Remove irrelevant block templates from the list of available templates for products.
remove_meta_boxes()  : mixed
Remove bloat.
rename_meta_boxes()  : mixed
Rename core meta boxes.
save_errors()  : mixed
Save errors to an option.
save_meta_boxes()  : mixed
Check if we're saving, the trigger an action based on the post type.

Constants

ERROR_STORE

Name of the option used to store errors to be displayed at the next suitable opportunity.

public mixed ERROR_STORE = 'woocommerce_meta_box_errors'
Tags
since
6.5.0

Properties

Methods

append_to_error_store()

If additional errors have been added in the current request (ie, via the add_error() method) then they will be added to the persistent error store via the Options API.

public append_to_error_store() : mixed
Tags
since
6.5.0
Return values
mixed

remove_block_templates()

Remove irrelevant block templates from the list of available templates for products.

public remove_block_templates(array<string|int, string> $templates) : array<string|int, string>

This will also remove custom created templates.

Parameters
$templates : array<string|int, string>

Array of template header names keyed by the template file name.

Return values
array<string|int, string>Templates array excluding block-based templates.

save_errors()

Save errors to an option.

public save_errors() : mixed

Note that calling this will overwrite any errors that have already been stored via the Options API. Unless you are sure you want this, consider using the append_to_error_store() method instead.

Return values
mixed

save_meta_boxes()

Check if we're saving, the trigger an action based on the post type.

public save_meta_boxes(int $post_id, object $post) : mixed
Parameters
$post_id : int

Post ID.

$post : object

Post object.

Return values
mixed