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3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / class-wc-post-types.php
woocommerce / includes Last commit date
abstracts 3 years ago admin 3 years ago blocks 5 years ago cli 3 years ago customizer 3 years ago data-stores 3 years ago emails 3 years ago export 3 years ago gateways 3 years ago import 3 years ago integrations 4 years ago interfaces 3 years ago legacy 3 years ago libraries 3 years ago log-handlers 4 years ago payment-tokens 5 years ago queue 4 years ago react-admin 3 years ago rest-api 3 years ago shipping 4 years ago shortcodes 3 years ago theme-support 3 years ago tracks 3 years ago traits 5 years ago walkers 5 years ago wccom-site 5 years ago widgets 3 years ago class-wc-ajax.php 3 years ago class-wc-api.php 4 years ago class-wc-auth.php 4 years ago class-wc-autoloader.php 5 years ago class-wc-background-emailer.php 5 years ago class-wc-background-updater.php 5 years ago class-wc-breadcrumb.php 5 years ago class-wc-cache-helper.php 3 years ago class-wc-cart-fees.php 5 years ago class-wc-cart-session.php 3 years ago class-wc-cart-totals.php 4 years ago class-wc-cart.php 3 years ago class-wc-checkout.php 3 years ago class-wc-cli.php 3 years ago class-wc-comments.php 3 years ago class-wc-countries.php 3 years ago class-wc-coupon.php 3 years ago class-wc-customer-download-log.php 5 years ago class-wc-customer-download.php 4 years ago class-wc-customer.php 4 years ago class-wc-data-exception.php 8 years ago class-wc-data-store.php 3 years ago class-wc-datetime.php 4 years ago class-wc-deprecated-action-hooks.php 8 years ago class-wc-deprecated-filter-hooks.php 3 years ago class-wc-discounts.php 3 years ago class-wc-download-handler.php 3 years ago class-wc-emails.php 3 years ago class-wc-embed.php 5 years ago class-wc-form-handler.php 4 years ago class-wc-frontend-scripts.php 3 years ago class-wc-geo-ip.php 4 years ago class-wc-geolite-integration.php 6 years ago class-wc-geolocation.php 3 years ago class-wc-https.php 4 years ago class-wc-install.php 3 years ago class-wc-integrations.php 5 years ago class-wc-log-levels.php 5 years ago class-wc-logger.php 4 years ago class-wc-meta-data.php 4 years ago class-wc-order-factory.php 3 years ago class-wc-order-item-coupon.php 4 years ago class-wc-order-item-fee.php 4 years ago class-wc-order-item-meta.php 4 years ago class-wc-order-item-product.php 4 years ago class-wc-order-item-shipping.php 4 years ago class-wc-order-item-tax.php 4 years ago class-wc-order-item.php 4 years ago class-wc-order-query.php 4 years ago class-wc-order-refund.php 3 years ago class-wc-order.php 3 years ago class-wc-payment-gateways.php 4 years ago class-wc-payment-tokens.php 3 years ago class-wc-post-data.php 3 years ago class-wc-post-types.php 3 years ago class-wc-privacy-background-process.php 5 years ago class-wc-privacy-erasers.php 4 years ago class-wc-privacy-exporters.php 4 years ago class-wc-privacy.php 4 years ago class-wc-product-attribute.php 4 years ago class-wc-product-download.php 4 years ago class-wc-product-external.php 5 years ago class-wc-product-factory.php 5 years ago class-wc-product-grouped.php 8 years ago class-wc-product-query.php 5 years ago class-wc-product-simple.php 3 years ago class-wc-product-variable.php 4 years ago class-wc-product-variation.php 4 years ago class-wc-query.php 3 years ago class-wc-rate-limiter.php 4 years ago class-wc-regenerate-images-request.php 3 years ago class-wc-regenerate-images.php 3 years ago class-wc-register-wp-admin-settings.php 4 years ago class-wc-rest-authentication.php 5 years ago class-wc-rest-exception.php 5 years ago class-wc-session-handler.php 3 years ago class-wc-shipping-rate.php 3 years ago class-wc-shipping-zone.php 5 years ago class-wc-shipping-zones.php 5 years ago class-wc-shipping.php 4 years ago class-wc-shortcodes.php 5 years ago class-wc-structured-data.php 5 years ago class-wc-tax.php 4 years ago class-wc-template-loader.php 3 years ago class-wc-tracker.php 3 years ago class-wc-validation.php 3 years ago class-wc-webhook.php 3 years ago class-woocommerce.php 3 years ago wc-account-functions.php 3 years ago wc-attribute-functions.php 3 years ago wc-cart-functions.php 3 years ago wc-conditional-functions.php 3 years ago wc-core-functions.php 3 years ago wc-coupon-functions.php 3 years ago wc-deprecated-functions.php 3 years ago wc-formatting-functions.php 3 years ago wc-notice-functions.php 5 years ago wc-order-functions.php 3 years ago wc-order-item-functions.php 3 years ago wc-page-functions.php 5 years ago wc-product-functions.php 3 years ago wc-rest-functions.php 3 years ago wc-stock-functions.php 3 years ago wc-template-functions.php 3 years ago wc-template-hooks.php 5 years ago wc-term-functions.php 3 years ago wc-update-functions.php 3 years ago wc-user-functions.php 3 years ago wc-webhook-functions.php 4 years ago wc-widget-functions.php 5 years ago
class-wc-post-types.php
795 lines
1 <?php
2 /**
3 * Post Types
4 *
5 * Registers post types and taxonomies.
6 *
7 * @package WooCommerce\Classes\Products
8 * @version 2.5.0
9 */
10
11 defined( 'ABSPATH' ) || exit;
12
13 use Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController;
14
15 /**
16 * Post types Class.
17 */
18 class WC_Post_Types {
19
20 /**
21 * Hook in methods.
22 */
23 public static function init() {
24 add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 );
25 add_action( 'init', array( __CLASS__, 'register_post_types' ), 5 );
26 add_action( 'init', array( __CLASS__, 'register_post_status' ), 9 );
27 add_action( 'init', array( __CLASS__, 'support_jetpack_omnisearch' ) );
28 add_filter( 'term_updated_messages', array( __CLASS__, 'updated_term_messages' ) );
29 add_filter( 'rest_api_allowed_post_types', array( __CLASS__, 'rest_api_allowed_post_types' ) );
30 add_action( 'woocommerce_after_register_post_type', array( __CLASS__, 'maybe_flush_rewrite_rules' ) );
31 add_action( 'woocommerce_flush_rewrite_rules', array( __CLASS__, 'flush_rewrite_rules' ) );
32 add_filter( 'gutenberg_can_edit_post_type', array( __CLASS__, 'gutenberg_can_edit_post_type' ), 10, 2 );
33 add_filter( 'use_block_editor_for_post_type', array( __CLASS__, 'gutenberg_can_edit_post_type' ), 10, 2 );
34 }
35
36 /**
37 * Register core taxonomies.
38 */
39 public static function register_taxonomies() {
40
41 if ( ! is_blog_installed() ) {
42 return;
43 }
44
45 if ( taxonomy_exists( 'product_type' ) ) {
46 return;
47 }
48
49 do_action( 'woocommerce_register_taxonomy' );
50
51 $permalinks = wc_get_permalink_structure();
52
53 register_taxonomy(
54 'product_type',
55 apply_filters( 'woocommerce_taxonomy_objects_product_type', array( 'product' ) ),
56 apply_filters(
57 'woocommerce_taxonomy_args_product_type',
58 array(
59 'hierarchical' => false,
60 'show_ui' => false,
61 'show_in_nav_menus' => false,
62 'query_var' => is_admin(),
63 'rewrite' => false,
64 'public' => false,
65 'label' => _x( 'Product type', 'Taxonomy name', 'woocommerce' ),
66 )
67 )
68 );
69
70 register_taxonomy(
71 'product_visibility',
72 apply_filters( 'woocommerce_taxonomy_objects_product_visibility', array( 'product', 'product_variation' ) ),
73 apply_filters(
74 'woocommerce_taxonomy_args_product_visibility',
75 array(
76 'hierarchical' => false,
77 'show_ui' => false,
78 'show_in_nav_menus' => false,
79 'query_var' => is_admin(),
80 'rewrite' => false,
81 'public' => false,
82 'label' => _x( 'Product visibility', 'Taxonomy name', 'woocommerce' ),
83 )
84 )
85 );
86
87 register_taxonomy(
88 'product_cat',
89 apply_filters( 'woocommerce_taxonomy_objects_product_cat', array( 'product' ) ),
90 apply_filters(
91 'woocommerce_taxonomy_args_product_cat',
92 array(
93 'hierarchical' => true,
94 'update_count_callback' => '_wc_term_recount',
95 'label' => __( 'Categories', 'woocommerce' ),
96 'labels' => array(
97 'name' => __( 'Product categories', 'woocommerce' ),
98 'singular_name' => __( 'Category', 'woocommerce' ),
99 'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ),
100 'search_items' => __( 'Search categories', 'woocommerce' ),
101 'all_items' => __( 'All categories', 'woocommerce' ),
102 'parent_item' => __( 'Parent category', 'woocommerce' ),
103 'parent_item_colon' => __( 'Parent category:', 'woocommerce' ),
104 'edit_item' => __( 'Edit category', 'woocommerce' ),
105 'update_item' => __( 'Update category', 'woocommerce' ),
106 'add_new_item' => __( 'Add new category', 'woocommerce' ),
107 'new_item_name' => __( 'New category name', 'woocommerce' ),
108 'not_found' => __( 'No categories found', 'woocommerce' ),
109 'item_link' => __( 'Product Category Link', 'woocommerce' ),
110 'item_link_description' => __( 'A link to a product category.', 'woocommerce' ),
111 ),
112 'show_in_rest' => true,
113 'show_ui' => true,
114 'query_var' => true,
115 'capabilities' => array(
116 'manage_terms' => 'manage_product_terms',
117 'edit_terms' => 'edit_product_terms',
118 'delete_terms' => 'delete_product_terms',
119 'assign_terms' => 'assign_product_terms',
120 ),
121 'rewrite' => array(
122 'slug' => $permalinks['category_rewrite_slug'],
123 'with_front' => false,
124 'hierarchical' => true,
125 ),
126 )
127 )
128 );
129
130 register_taxonomy(
131 'product_tag',
132 apply_filters( 'woocommerce_taxonomy_objects_product_tag', array( 'product' ) ),
133 apply_filters(
134 'woocommerce_taxonomy_args_product_tag',
135 array(
136 'hierarchical' => false,
137 'update_count_callback' => '_wc_term_recount',
138 'label' => __( 'Product tags', 'woocommerce' ),
139 'labels' => array(
140 'name' => __( 'Product tags', 'woocommerce' ),
141 'singular_name' => __( 'Tag', 'woocommerce' ),
142 'menu_name' => _x( 'Tags', 'Admin menu name', 'woocommerce' ),
143 'search_items' => __( 'Search tags', 'woocommerce' ),
144 'all_items' => __( 'All tags', 'woocommerce' ),
145 'edit_item' => __( 'Edit tag', 'woocommerce' ),
146 'update_item' => __( 'Update tag', 'woocommerce' ),
147 'add_new_item' => __( 'Add new tag', 'woocommerce' ),
148 'new_item_name' => __( 'New tag name', 'woocommerce' ),
149 'popular_items' => __( 'Popular tags', 'woocommerce' ),
150 'separate_items_with_commas' => __( 'Separate tags with commas', 'woocommerce' ),
151 'add_or_remove_items' => __( 'Add or remove tags', 'woocommerce' ),
152 'choose_from_most_used' => __( 'Choose from the most used tags', 'woocommerce' ),
153 'not_found' => __( 'No tags found', 'woocommerce' ),
154 'item_link' => __( 'Product Tag Link', 'woocommerce' ),
155 'item_link_description' => __( 'A link to a product tag.', 'woocommerce' ),
156 ),
157 'show_in_rest' => true,
158 'show_ui' => true,
159 'query_var' => true,
160 'capabilities' => array(
161 'manage_terms' => 'manage_product_terms',
162 'edit_terms' => 'edit_product_terms',
163 'delete_terms' => 'delete_product_terms',
164 'assign_terms' => 'assign_product_terms',
165 ),
166 'rewrite' => array(
167 'slug' => $permalinks['tag_rewrite_slug'],
168 'with_front' => false,
169 ),
170 )
171 )
172 );
173
174 register_taxonomy(
175 'product_shipping_class',
176 apply_filters( 'woocommerce_taxonomy_objects_product_shipping_class', array( 'product', 'product_variation' ) ),
177 apply_filters(
178 'woocommerce_taxonomy_args_product_shipping_class',
179 array(
180 'hierarchical' => false,
181 'update_count_callback' => '_update_post_term_count',
182 'label' => __( 'Shipping classes', 'woocommerce' ),
183 'labels' => array(
184 'name' => __( 'Product shipping classes', 'woocommerce' ),
185 'singular_name' => __( 'Shipping class', 'woocommerce' ),
186 'menu_name' => _x( 'Shipping classes', 'Admin menu name', 'woocommerce' ),
187 'search_items' => __( 'Search shipping classes', 'woocommerce' ),
188 'all_items' => __( 'All shipping classes', 'woocommerce' ),
189 'parent_item' => __( 'Parent shipping class', 'woocommerce' ),
190 'parent_item_colon' => __( 'Parent shipping class:', 'woocommerce' ),
191 'edit_item' => __( 'Edit shipping class', 'woocommerce' ),
192 'update_item' => __( 'Update shipping class', 'woocommerce' ),
193 'add_new_item' => __( 'Add new shipping class', 'woocommerce' ),
194 'new_item_name' => __( 'New shipping class Name', 'woocommerce' ),
195 ),
196 'show_ui' => false,
197 'show_in_quick_edit' => false,
198 'show_in_nav_menus' => false,
199 'query_var' => is_admin(),
200 'capabilities' => array(
201 'manage_terms' => 'manage_product_terms',
202 'edit_terms' => 'edit_product_terms',
203 'delete_terms' => 'delete_product_terms',
204 'assign_terms' => 'assign_product_terms',
205 ),
206 'rewrite' => false,
207 )
208 )
209 );
210
211 global $wc_product_attributes;
212
213 $wc_product_attributes = array();
214 $attribute_taxonomies = wc_get_attribute_taxonomies();
215
216 if ( $attribute_taxonomies ) {
217 foreach ( $attribute_taxonomies as $tax ) {
218 $name = wc_attribute_taxonomy_name( $tax->attribute_name );
219
220 if ( $name ) {
221 $tax->attribute_public = absint( isset( $tax->attribute_public ) ? $tax->attribute_public : 1 );
222 $label = ! empty( $tax->attribute_label ) ? $tax->attribute_label : $tax->attribute_name;
223 $wc_product_attributes[ $name ] = $tax;
224 $taxonomy_data = array(
225 'hierarchical' => false,
226 'update_count_callback' => '_update_post_term_count',
227 'labels' => array(
228 /* translators: %s: attribute name */
229 'name' => sprintf( _x( 'Product %s', 'Product Attribute', 'woocommerce' ), $label ),
230 'singular_name' => $label,
231 /* translators: %s: attribute name */
232 'search_items' => sprintf( __( 'Search %s', 'woocommerce' ), $label ),
233 /* translators: %s: attribute name */
234 'all_items' => sprintf( __( 'All %s', 'woocommerce' ), $label ),
235 /* translators: %s: attribute name */
236 'parent_item' => sprintf( __( 'Parent %s', 'woocommerce' ), $label ),
237 /* translators: %s: attribute name */
238 'parent_item_colon' => sprintf( __( 'Parent %s:', 'woocommerce' ), $label ),
239 /* translators: %s: attribute name */
240 'edit_item' => sprintf( __( 'Edit %s', 'woocommerce' ), $label ),
241 /* translators: %s: attribute name */
242 'update_item' => sprintf( __( 'Update %s', 'woocommerce' ), $label ),
243 /* translators: %s: attribute name */
244 'add_new_item' => sprintf( __( 'Add new %s', 'woocommerce' ), $label ),
245 /* translators: %s: attribute name */
246 'new_item_name' => sprintf( __( 'New %s', 'woocommerce' ), $label ),
247 /* translators: %s: attribute name */
248 'not_found' => sprintf( __( 'No &quot;%s&quot; found', 'woocommerce' ), $label ),
249 /* translators: %s: attribute name */
250 'back_to_items' => sprintf( __( '&larr; Back to "%s" attributes', 'woocommerce' ), $label ),
251 ),
252 'show_ui' => true,
253 'show_in_quick_edit' => false,
254 'show_in_menu' => false,
255 'meta_box_cb' => false,
256 'query_var' => 1 === $tax->attribute_public,
257 'rewrite' => false,
258 'sort' => false,
259 'public' => 1 === $tax->attribute_public,
260 'show_in_nav_menus' => 1 === $tax->attribute_public && apply_filters( 'woocommerce_attribute_show_in_nav_menus', false, $name ),
261 'capabilities' => array(
262 'manage_terms' => 'manage_product_terms',
263 'edit_terms' => 'edit_product_terms',
264 'delete_terms' => 'delete_product_terms',
265 'assign_terms' => 'assign_product_terms',
266 ),
267 );
268
269 if ( 1 === $tax->attribute_public && sanitize_title( $tax->attribute_name ) ) {
270 $taxonomy_data['rewrite'] = array(
271 'slug' => trailingslashit( $permalinks['attribute_rewrite_slug'] ) . urldecode( sanitize_title( $tax->attribute_name ) ),
272 'with_front' => false,
273 'hierarchical' => true,
274 );
275 }
276
277 register_taxonomy( $name, apply_filters( "woocommerce_taxonomy_objects_{$name}", array( 'product' ) ), apply_filters( "woocommerce_taxonomy_args_{$name}", $taxonomy_data ) );
278 }
279 }
280 }
281
282 do_action( 'woocommerce_after_register_taxonomy' );
283 }
284
285 /**
286 * Register core post types.
287 */
288 public static function register_post_types() {
289 if ( ! is_blog_installed() || post_type_exists( 'product' ) ) {
290 return;
291 }
292
293 do_action( 'woocommerce_register_post_type' );
294
295 $permalinks = wc_get_permalink_structure();
296 $supports = array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'publicize', 'wpcom-markdown' );
297
298 if ( 'yes' === get_option( 'woocommerce_enable_reviews', 'yes' ) ) {
299 $supports[] = 'comments';
300 }
301
302 $shop_page_id = wc_get_page_id( 'shop' );
303
304 if ( wc_current_theme_supports_woocommerce_or_fse() ) {
305 $has_archive = $shop_page_id && get_post( $shop_page_id ) ? urldecode( get_page_uri( $shop_page_id ) ) : 'shop';
306 } else {
307 $has_archive = false;
308 }
309
310 // If theme support changes, we may need to flush permalinks since some are changed based on this flag.
311 $theme_support = wc_current_theme_supports_woocommerce_or_fse() ? 'yes' : 'no';
312 if ( get_option( 'current_theme_supports_woocommerce' ) !== $theme_support && update_option( 'current_theme_supports_woocommerce', $theme_support ) ) {
313 update_option( 'woocommerce_queue_flush_rewrite_rules', 'yes' );
314 }
315
316 register_post_type(
317 'product',
318 apply_filters(
319 'woocommerce_register_post_type_product',
320 array(
321 'labels' => array(
322 'name' => __( 'Products', 'woocommerce' ),
323 'singular_name' => __( 'Product', 'woocommerce' ),
324 'all_items' => __( 'All Products', 'woocommerce' ),
325 'menu_name' => _x( 'Products', 'Admin menu name', 'woocommerce' ),
326 'add_new' => __( 'Add New', 'woocommerce' ),
327 'add_new_item' => __( 'Add new product', 'woocommerce' ),
328 'edit' => __( 'Edit', 'woocommerce' ),
329 'edit_item' => __( 'Edit product', 'woocommerce' ),
330 'new_item' => __( 'New product', 'woocommerce' ),
331 'view_item' => __( 'View product', 'woocommerce' ),
332 'view_items' => __( 'View products', 'woocommerce' ),
333 'search_items' => __( 'Search products', 'woocommerce' ),
334 'not_found' => __( 'No products found', 'woocommerce' ),
335 'not_found_in_trash' => __( 'No products found in trash', 'woocommerce' ),
336 'parent' => __( 'Parent product', 'woocommerce' ),
337 'featured_image' => __( 'Product image', 'woocommerce' ),
338 'set_featured_image' => __( 'Set product image', 'woocommerce' ),
339 'remove_featured_image' => __( 'Remove product image', 'woocommerce' ),
340 'use_featured_image' => __( 'Use as product image', 'woocommerce' ),
341 'insert_into_item' => __( 'Insert into product', 'woocommerce' ),
342 'uploaded_to_this_item' => __( 'Uploaded to this product', 'woocommerce' ),
343 'filter_items_list' => __( 'Filter products', 'woocommerce' ),
344 'items_list_navigation' => __( 'Products navigation', 'woocommerce' ),
345 'items_list' => __( 'Products list', 'woocommerce' ),
346 'item_link' => __( 'Product Link', 'woocommerce' ),
347 'item_link_description' => __( 'A link to a product.', 'woocommerce' ),
348 ),
349 'description' => __( 'This is where you can browse products in this store.', 'woocommerce' ),
350 'public' => true,
351 'show_ui' => true,
352 'menu_icon' => 'dashicons-archive',
353 'capability_type' => 'product',
354 'map_meta_cap' => true,
355 'publicly_queryable' => true,
356 'exclude_from_search' => false,
357 'hierarchical' => false, // Hierarchical causes memory issues - WP loads all records!
358 'rewrite' => $permalinks['product_rewrite_slug'] ? array(
359 'slug' => $permalinks['product_rewrite_slug'],
360 'with_front' => false,
361 'feeds' => true,
362 ) : false,
363 'query_var' => true,
364 'supports' => $supports,
365 'has_archive' => $has_archive,
366 'show_in_nav_menus' => true,
367 'show_in_rest' => true,
368 'rest_namespace' => 'wp/v3',
369 'template' => array(
370 array(
371 'woocommerce/product-tab',
372 array(
373 'id' => 'general',
374 'title' => __( 'General', 'woocommerce' ),
375 ),
376 array(
377 array(
378 'woocommerce/product-section',
379 array(
380 'title' => __( 'Basic details', 'woocommerce' ),
381 'description' => __( 'This info will be displayed on the product page, category pages, social media, and search results.', 'woocommerce' ),
382 ),
383 array(
384 array(
385 'woocommerce/product-name',
386 array(
387 'name' => 'Product name',
388 ),
389 ),
390 array(
391 'core/columns',
392 array(),
393 array(
394 array(
395 'core/column',
396 array(
397 'templateLock' => 'all',
398 ),
399 array(
400 array(
401 'woocommerce/product-pricing',
402 array(
403 'name' => 'regular_price',
404 'label' => __( 'List price', 'woocommerce' ),
405 'showPricingSection' => true,
406 ),
407 ),
408 ),
409 ),
410 array(
411 'core/column',
412 array(
413 'templateLock' => 'all',
414 ),
415 array(
416 array(
417 'woocommerce/product-pricing',
418 array(
419 'name' => 'sale_price',
420 'label' => __( 'Sale price', 'woocommerce' ),
421 ),
422 ),
423 ),
424 ),
425 ),
426 ),
427 ),
428 ),
429 ),
430 ),
431 array(
432 'woocommerce/product-tab',
433 array(
434 'id' => 'pricing',
435 'title' => __( 'Pricing', 'woocommerce' ),
436 ),
437 ),
438 array(
439 'woocommerce/product-tab',
440 array(
441 'id' => 'inventory',
442 'title' => __( 'Inventory', 'woocommerce' ),
443 ),
444 ),
445 array(
446 'woocommerce/product-tab',
447 array(
448 'id' => 'shipping',
449 'title' => __( 'Shipping', 'woocommerce' ),
450 ),
451 array(
452 array(
453 'woocommerce/product-section',
454 array(
455 'title' => __( 'Shipping section', 'woocommerce' ),
456 ),
457 array(
458 array(
459 'core/image',
460 ),
461 ),
462 ),
463 ),
464 ),
465 ),
466 )
467 )
468 );
469
470 register_post_type(
471 'product_variation',
472 apply_filters(
473 'woocommerce_register_post_type_product_variation',
474 array(
475 'label' => __( 'Variations', 'woocommerce' ),
476 'public' => false,
477 'hierarchical' => false,
478 'supports' => false,
479 'capability_type' => 'product',
480 'rewrite' => false,
481 )
482 )
483 );
484
485 wc_register_order_type(
486 'shop_order',
487 apply_filters(
488 'woocommerce_register_post_type_shop_order',
489 array(
490 'labels' => array(
491 'name' => __( 'Orders', 'woocommerce' ),
492 'singular_name' => _x( 'Order', 'shop_order post type singular name', 'woocommerce' ),
493 'add_new' => __( 'Add order', 'woocommerce' ),
494 'add_new_item' => __( 'Add new order', 'woocommerce' ),
495 'edit' => __( 'Edit', 'woocommerce' ),
496 'edit_item' => __( 'Edit order', 'woocommerce' ),
497 'new_item' => __( 'New order', 'woocommerce' ),
498 'view_item' => __( 'View order', 'woocommerce' ),
499 'search_items' => __( 'Search orders', 'woocommerce' ),
500 'not_found' => __( 'No orders found', 'woocommerce' ),
501 'not_found_in_trash' => __( 'No orders found in trash', 'woocommerce' ),
502 'parent' => __( 'Parent orders', 'woocommerce' ),
503 'menu_name' => _x( 'Orders', 'Admin menu name', 'woocommerce' ),
504 'filter_items_list' => __( 'Filter orders', 'woocommerce' ),
505 'items_list_navigation' => __( 'Orders navigation', 'woocommerce' ),
506 'items_list' => __( 'Orders list', 'woocommerce' ),
507 ),
508 'description' => __( 'This is where store orders are stored.', 'woocommerce' ),
509 'public' => false,
510 'show_ui' => true,
511 'capability_type' => 'shop_order',
512 'map_meta_cap' => true,
513 'publicly_queryable' => false,
514 'exclude_from_search' => true,
515 'show_in_menu' => current_user_can( 'edit_others_shop_orders' ) ? 'woocommerce' : true,
516 'hierarchical' => false,
517 'show_in_nav_menus' => false,
518 'rewrite' => false,
519 'query_var' => false,
520 'supports' => array( 'title', 'comments', 'custom-fields' ),
521 'has_archive' => false,
522 )
523 )
524 );
525
526 wc_register_order_type(
527 'shop_order_refund',
528 apply_filters(
529 'woocommerce_register_post_type_shop_order_refund',
530 array(
531 'label' => __( 'Refunds', 'woocommerce' ),
532 'capability_type' => 'shop_order',
533 'public' => false,
534 'hierarchical' => false,
535 'supports' => false,
536 'exclude_from_orders_screen' => false,
537 'add_order_meta_boxes' => false,
538 'exclude_from_order_count' => true,
539 'exclude_from_order_views' => false,
540 'exclude_from_order_reports' => false,
541 'exclude_from_order_sales_reports' => true,
542 'class_name' => 'WC_Order_Refund',
543 'rewrite' => false,
544 )
545 )
546 );
547
548 if ( 'yes' === get_option( 'woocommerce_enable_coupons' ) ) {
549 register_post_type(
550 'shop_coupon',
551 apply_filters(
552 'woocommerce_register_post_type_shop_coupon',
553 array(
554 'labels' => array(
555 'name' => __( 'Coupons', 'woocommerce' ),
556 'singular_name' => __( 'Coupon', 'woocommerce' ),
557 'menu_name' => _x( 'Coupons', 'Admin menu name', 'woocommerce' ),
558 'add_new' => __( 'Add coupon', 'woocommerce' ),
559 'add_new_item' => __( 'Add new coupon', 'woocommerce' ),
560 'edit' => __( 'Edit', 'woocommerce' ),
561 'edit_item' => __( 'Edit coupon', 'woocommerce' ),
562 'new_item' => __( 'New coupon', 'woocommerce' ),
563 'view_item' => __( 'View coupon', 'woocommerce' ),
564 'search_items' => __( 'Search coupons', 'woocommerce' ),
565 'not_found' => __( 'No coupons found', 'woocommerce' ),
566 'not_found_in_trash' => __( 'No coupons found in trash', 'woocommerce' ),
567 'parent' => __( 'Parent coupon', 'woocommerce' ),
568 'filter_items_list' => __( 'Filter coupons', 'woocommerce' ),
569 'items_list_navigation' => __( 'Coupons navigation', 'woocommerce' ),
570 'items_list' => __( 'Coupons list', 'woocommerce' ),
571 ),
572 'description' => __( 'This is where you can add new coupons that customers can use in your store.', 'woocommerce' ),
573 'public' => false,
574 'show_ui' => true,
575 'capability_type' => 'shop_coupon',
576 'map_meta_cap' => true,
577 'publicly_queryable' => false,
578 'exclude_from_search' => true,
579 'show_in_menu' => current_user_can( 'edit_others_shop_orders' ) ? 'woocommerce' : true,
580 'hierarchical' => false,
581 'rewrite' => false,
582 'query_var' => false,
583 'supports' => array( 'title' ),
584 'show_in_nav_menus' => false,
585 'show_in_admin_bar' => true,
586 )
587 )
588 );
589 }
590
591 do_action( 'woocommerce_after_register_post_type' );
592 }
593
594 /**
595 * Customize taxonomies update messages.
596 *
597 * @param array $messages The list of available messages.
598 * @since 4.4.0
599 * @return bool
600 */
601 public static function updated_term_messages( $messages ) {
602 $messages['product_cat'] = array(
603 0 => '',
604 1 => __( 'Category added.', 'woocommerce' ),
605 2 => __( 'Category deleted.', 'woocommerce' ),
606 3 => __( 'Category updated.', 'woocommerce' ),
607 4 => __( 'Category not added.', 'woocommerce' ),
608 5 => __( 'Category not updated.', 'woocommerce' ),
609 6 => __( 'Categories deleted.', 'woocommerce' ),
610 );
611
612 $messages['product_tag'] = array(
613 0 => '',
614 1 => __( 'Tag added.', 'woocommerce' ),
615 2 => __( 'Tag deleted.', 'woocommerce' ),
616 3 => __( 'Tag updated.', 'woocommerce' ),
617 4 => __( 'Tag not added.', 'woocommerce' ),
618 5 => __( 'Tag not updated.', 'woocommerce' ),
619 6 => __( 'Tags deleted.', 'woocommerce' ),
620 );
621
622 $wc_product_attributes = array();
623 $attribute_taxonomies = wc_get_attribute_taxonomies();
624
625 if ( $attribute_taxonomies ) {
626 foreach ( $attribute_taxonomies as $tax ) {
627 $name = wc_attribute_taxonomy_name( $tax->attribute_name );
628
629 if ( $name ) {
630 $label = ! empty( $tax->attribute_label ) ? $tax->attribute_label : $tax->attribute_name;
631
632 $messages[ $name ] = array(
633 0 => '',
634 /* translators: %s: taxonomy label */
635 1 => sprintf( _x( '%s added', 'taxonomy term messages', 'woocommerce' ), $label ),
636 /* translators: %s: taxonomy label */
637 2 => sprintf( _x( '%s deleted', 'taxonomy term messages', 'woocommerce' ), $label ),
638 /* translators: %s: taxonomy label */
639 3 => sprintf( _x( '%s updated', 'taxonomy term messages', 'woocommerce' ), $label ),
640 /* translators: %s: taxonomy label */
641 4 => sprintf( _x( '%s not added', 'taxonomy term messages', 'woocommerce' ), $label ),
642 /* translators: %s: taxonomy label */
643 5 => sprintf( _x( '%s not updated', 'taxonomy term messages', 'woocommerce' ), $label ),
644 /* translators: %s: taxonomy label */
645 6 => sprintf( _x( '%s deleted', 'taxonomy term messages', 'woocommerce' ), $label ),
646 );
647 }
648 }
649 }
650
651 return $messages;
652 }
653
654 /**
655 * Register our custom post statuses, used for order status.
656 */
657 public static function register_post_status() {
658
659 $order_statuses = apply_filters(
660 'woocommerce_register_shop_order_post_statuses',
661 array(
662 'wc-pending' => array(
663 'label' => _x( 'Pending payment', 'Order status', 'woocommerce' ),
664 'public' => false,
665 'exclude_from_search' => false,
666 'show_in_admin_all_list' => true,
667 'show_in_admin_status_list' => true,
668 /* translators: %s: number of orders */
669 'label_count' => _n_noop( 'Pending payment <span class="count">(%s)</span>', 'Pending payment <span class="count">(%s)</span>', 'woocommerce' ),
670 ),
671 'wc-processing' => array(
672 'label' => _x( 'Processing', 'Order status', 'woocommerce' ),
673 'public' => false,
674 'exclude_from_search' => false,
675 'show_in_admin_all_list' => true,
676 'show_in_admin_status_list' => true,
677 /* translators: %s: number of orders */
678 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'woocommerce' ),
679 ),
680 'wc-on-hold' => array(
681 'label' => _x( 'On hold', 'Order status', 'woocommerce' ),
682 'public' => false,
683 'exclude_from_search' => false,
684 'show_in_admin_all_list' => true,
685 'show_in_admin_status_list' => true,
686 /* translators: %s: number of orders */
687 'label_count' => _n_noop( 'On hold <span class="count">(%s)</span>', 'On hold <span class="count">(%s)</span>', 'woocommerce' ),
688 ),
689 'wc-completed' => array(
690 'label' => _x( 'Completed', 'Order status', 'woocommerce' ),
691 'public' => false,
692 'exclude_from_search' => false,
693 'show_in_admin_all_list' => true,
694 'show_in_admin_status_list' => true,
695 /* translators: %s: number of orders */
696 'label_count' => _n_noop( 'Completed <span class="count">(%s)</span>', 'Completed <span class="count">(%s)</span>', 'woocommerce' ),
697 ),
698 'wc-cancelled' => array(
699 'label' => _x( 'Cancelled', 'Order status', 'woocommerce' ),
700 'public' => false,
701 'exclude_from_search' => false,
702 'show_in_admin_all_list' => true,
703 'show_in_admin_status_list' => true,
704 /* translators: %s: number of orders */
705 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'woocommerce' ),
706 ),
707 'wc-refunded' => array(
708 'label' => _x( 'Refunded', 'Order status', 'woocommerce' ),
709 'public' => false,
710 'exclude_from_search' => false,
711 'show_in_admin_all_list' => true,
712 'show_in_admin_status_list' => true,
713 /* translators: %s: number of orders */
714 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'woocommerce' ),
715 ),
716 'wc-failed' => array(
717 'label' => _x( 'Failed', 'Order status', 'woocommerce' ),
718 'public' => false,
719 'exclude_from_search' => false,
720 'show_in_admin_all_list' => true,
721 'show_in_admin_status_list' => true,
722 /* translators: %s: number of orders */
723 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'woocommerce' ),
724 ),
725 'auto-draft' => array(
726 'label' => _x( 'Auto Draft', 'Order status', 'woocommerce' ),
727 'public' => false,
728 'exclude_from_search' => false,
729 'show_in_admin_all_list' => true,
730 'show_in_admin_status_list' => true,
731 /* translators: %s: number of orders */
732 'label_count' => _n_noop( 'Auto draft <span class="count">(%s)</span>', 'Auto draft <span class="count">(%s)</span>', 'woocommerce' ),
733 ),
734 )
735 );
736
737 foreach ( $order_statuses as $order_status => $values ) {
738 register_post_status( $order_status, $values );
739 }
740 }
741
742 /**
743 * Flush rules if the event is queued.
744 *
745 * @since 3.3.0
746 */
747 public static function maybe_flush_rewrite_rules() {
748 if ( 'yes' === get_option( 'woocommerce_queue_flush_rewrite_rules' ) ) {
749 update_option( 'woocommerce_queue_flush_rewrite_rules', 'no' );
750 self::flush_rewrite_rules();
751 }
752 }
753
754 /**
755 * Flush rewrite rules.
756 */
757 public static function flush_rewrite_rules() {
758 flush_rewrite_rules();
759 }
760
761 /**
762 * Disable Gutenberg for products.
763 *
764 * @param bool $can_edit Whether the post type can be edited or not.
765 * @param string $post_type The post type being checked.
766 * @return bool
767 */
768 public static function gutenberg_can_edit_post_type( $can_edit, $post_type ) {
769 return 'product' === $post_type ? false : $can_edit;
770 }
771
772 /**
773 * Add Product Support to Jetpack Omnisearch.
774 */
775 public static function support_jetpack_omnisearch() {
776 if ( class_exists( 'Jetpack_Omnisearch_Posts' ) ) {
777 new Jetpack_Omnisearch_Posts( 'product' );
778 }
779 }
780
781 /**
782 * Added product for Jetpack related posts.
783 *
784 * @param array $post_types Post types.
785 * @return array
786 */
787 public static function rest_api_allowed_post_types( $post_types ) {
788 $post_types[] = 'product';
789
790 return $post_types;
791 }
792 }
793
794 WC_Post_types::init();
795