• Resolved amorahmed

    (@amorahmed)


    i have a theme with custom woocomerce page in my_theme/woocommerce/* , and have created a plugin to do some customization , so i created my_plugin/woocommerce/form-checkout.php to overwrite my_theme/woocommerce/checkout–/form-checkout.php
    but the problem is that it can’t recognize wc functions (Call to undefined function wc_print_notices() .. etc )

    this is my plugin code to overwrite it
    the function :

    public function customize_theme_pages( $page_template ){
            if ( is_page( 'shop-checkout' ) ) {
                $page_template = plugin_dir_url(__FILE__). 'woocommerce/form-checkout.php';
            }
            return $page_template;
        }

    and the filter :
    add_filter( 'page_template', array($this,'customize_theme_pages') );

Viewing 2 replies - 1 through 2 (of 2 total)
  • dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hey @amorahmed,

    The best way to customize your WooCommerce site like this would be to use a theme template override rather than a plugin.

    We have some details in the documentation here – https://docs.woocommerce.com/document/template-structure/

    I hope this helps, have a great day!

    Thanks,

    dougaitken

    (@dougaitken)

    Automattic Happiness Engineer

    Hi @amorahmed

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘overwrite a woocomerce page’ is closed to new replies.