• Resolved Idenovasi

    (@idenovasi)


    Hi,
    I just tested import my theme with WooCommerce installed. All pages were imported successfully, but I got duplicated pages such as Shop, Cart, etc. Is there any ways to prevent this issue?

    Thank you

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Gregor Capuder

    (@capuderg)

    Hi @idenovasi,

    I think you are importing your version of the WooCommerce pages and WooCommerce also adds them when the plugin is activated (before the import).

    So you could investigate if WooCommerce has an option (WP hook action/filiter) to prevent the automatic pages generation. That should resolve your issue.

    Take care!

    The problem is that WooCommerce generating pages upon activation. So the only way I found is to assign our demo-content pages by ID after import is completed.

    update_option( 'woocommerce_shop_page_id', 198 );

    Plugin Author Gregor Capuder

    (@capuderg)

    Hi @deothemes,

    this might work on fresh WP installs, but if a user is importing content on an existing WP site, that ID (198), will most probably not correspond to your Shop page, because the IDs will be different for all imported items on an existing WP site.

    It would be better to actually search for your particular site’s ID with get_page_by_title( 'Shop' ) or get_page_by_path.

    Take care!

    Hi @capuderg,

    get_page_by_title( ‘Shop’ ) is not perfect either, since after WooCommerce activation there is already a page with a name Shop. Upon fresh WooCommerce activation, it generates pages Shop, Cart, Account etc with the ID’s between 1-20, I’ve tested it multiple times. There is a possibility that the user deleted these default pages and recreated them, but it’s a very rare case I think. But to make it more accurate, maybe we can check if the pages Cart, Shop, Account already exist, and if not, we can assign our imported pages, but if there are some, the new imported pages will have slugs cart-2, shop-2 etc, we can assign them.

    Cheers.

    Plugin Author Gregor Capuder

    (@capuderg)

    Hi @deothemes,

    yeah, I know, it’s not ideal. The solution could be to give your pages a different title or to use the get_page_by_path with shop-2 slug.

    Take care!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WooCommerce auto generated pages’ is closed to new replies.