1

I have an issue with existing website where I need to add WooCommerce. The website functions.php and other template files is built with some kind of a catalog:

function register_product() {
    $labels = array(
        'name' => _x('Catalog', 'post type general name','LADS'),
        'singular_name' => _x('Product', 'post type singular name','LADS'),
        'add_new' => _x('Add','LADS'),
        'add_new_item' => __('Add','LADS'),
        'edit_item' => __('Edit','LADS'),
        'new_item' => __('Add','LADS'),
        'all_items' => __('All','LADS'),
        'view_item' => __('View','LADS'),
        'search_items' => __('Search','LADS'),
        'not_found' =>  __('Nothing Found','LADS'),
        'not_found_in_trash' => __('Nothing Found','LADS'),
        'parent_item_colon' => ''
    );
    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'catalog' ),
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'taxonomies' => 'product_category',
        'supports' => array('title','editor','thumbnail','excerpt','comments','revisions','custom-fields')
    );
    register_post_type( 'product' , $args );
}
add_action('init', 'register_product');

Full code part here: https://pastebin.com/RYLHCXWz

The catalog is using WP post type "product" which makes it showing catalog entries and they conflict with WooCommerce as it is using the same post name by default.

Is it possible to force WooCommerce to use a different post type by default? For example "product1"?

twelvell
  • 257
  • 1
  • 8
  • 19
  • 1
    This may help https://stackoverflow.com/questions/34548188/adding-custom-post-type-post-to-woocommerce – Ozgur Sar Nov 17 '20 at 21:25
  • Thanks @ozgur but i am not sure it is the same case. In my case on the website already are posted 1000+ catalog entries under post type "product" and activating WooCommerce it thinks that they are products for WooCommerce which makes everything wrong. Deleting those entries is not an option and I don't know if rewriting existing code will help because I still need to migrate these to another post type name. – twelvell Nov 17 '20 at 21:46

0 Answers0