Change notice modal after adding to cart

This topic has 4 replies, 2 voices, and was last updated 4 years, 7 months ago ago by Rose Tyler

  • Avatar: kikjou
    Martin
    Participant
    March 28, 2020 at 08:36

    Hi,

    after adding a product to the cart a modal appears that allows jumping to the checkout. This is not quite ideal for the European market since the customer should not be guided that way to the checkout but first be shown the complete cart information.

    Is there a simple way to change the template so that it links to the cart instead?

    Admin credentials are in the private content area. In case you make adjustments, could you tell me where?

    Best regards
    Martin

    Please, contact administrator
    for this information.
    3 Answers
    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 28, 2020 at 09:06

    Hello,

    You can disable AJAX “Add To Cart” in Theme Options > E-Commerce > Single Product Page.
    To change the link – copy etheme_enqueue_scripts function from wp-content/themes/classico/framework/theme-init.php into functions.php of your child theme > change
    $etConf['checkoutUrl'] = esc_url( wc_get_checkout_url() );
    to
    $etConf['checkoutUrl'] = esc_url( wc_get_cart_url() );

    Regards

    Avatar: kikjou
    Martin
    Participant
    March 29, 2020 at 09:03

    Hi,

    thank you! I took the code from … /theme-init.php and put it in the functions.php of the child theme, but it didn’t work. It still linked to the checkout.

    if (class_exists('WooCommerce')) {
    global $woocommerce;
    $etConf['checkoutUrl'] = esc_url( wc_get_cart_url() );
    }

    I also tried only the line you sent me

    $etConf['checkoutUrl'] = esc_url( wc_get_cart_url() );

    What worked was placing the whole theme-init.php into the child theme. But is there a way to avoid this?

    Best regards
    Martin

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    March 29, 2020 at 09:30

    Hello,

    etheme_enqueue_scripts function should be rewritten via fucntions.php of the child theme, so just add this code –

    function etheme_enqueue_scripts() {
    
            if ( !is_admin() ) {
                
                $script_depends = array();
    
                if(class_exists('WooCommerce')) {
                    $script_depends = array('wc-add-to-cart-variation');
                }
                
                wp_enqueue_script('jquery');
                // HEAD wp_enqueue_script('modernizr', get_template_directory_uri().'/js/modernizr.js');
                wp_enqueue_script('head', get_template_directory_uri().'/js/head.min.js');
                // HEAD wp_enqueue_script('classie', get_template_directory_uri().'/js/classie.js');
                wp_enqueue_script('plugins', get_template_directory_uri().'/js/plugins.min.js',array(),false,true);
                // PLUGINS wp_enqueue_script('jquery-cookie', get_template_directory_uri().'/js/cookie.js',array(),false,true);
                wp_enqueue_script('hoverIntent', get_template_directory_uri().'/js/jquery.hoverIntent.js',array(),false,true);
                // HEAD wp_enqueue_script('owlcarousel', get_template_directory_uri().'/js/owl.carousel.min.js');
                // PLUGINS wp_enqueue_script('magnific-popup', get_template_directory_uri().'/js/jquery.magnific-popup.min.js',array(),false,true);
                // PLUGINS wp_enqueue_script('et_masonry', get_template_directory_uri().'/js/jquery.masonry.min.js',array(),false,true);
                // PLUGINS wp_enqueue_script('mediaelement-and-player', get_template_directory_uri().'/js/mediaelement-and-player.min.js',array(),false,true);
                // PLUGINS wp_enqueue_script('emodal', get_template_directory_uri().'/js/emodal.js',array(),false,true);
                // PLUGINS wp_enqueue_script('waypoint', get_template_directory_uri().'/js/waypoints.min.js',array(),false,true);
                // PLUGINS wp_enqueue_script('mousewheel', get_template_directory_uri().'/js/jquery.mousewheel.js',array(),false,true);
                if( class_exists( 'WooCommerce' ) )
                    wp_enqueue_script('et_zoom', get_template_directory_uri().'/js/zoom.js',array(),false,true);
                // HEAD wp_enqueue_script('swiper', get_template_directory_uri().'/js/swiper.min.js');
                wp_enqueue_script('etheme', get_template_directory_uri().'/js/etheme.min.js',$script_depends,false,true);
                //wp_enqueue_script('etheme', get_template_directory_uri().'/js/theme.min.js',$script_depends,false,true);
                
                
                $etConf = array(
                    'ajaxurl' => admin_url( 'admin-ajax.php' ),
                    'noresults' => __('No results were found!', 'classico'),
                    'successfullyAdded' => __('successfully added to your shopping cart', 'classico'),
                    'view_mode_default' => etheme_get_option('view_mode'),
                    'catsAccordion' => etheme_get_option('cats_accordion'),
                    'contBtn' => __('Continue shopping', 'classico'),
                    'checkBtn' => __('Checkout', 'classico'),
                    'warningAdded' => __('unfortunately this product was not added to cart', 'classico'),
                    
                );
                
                if (class_exists('WooCommerce')) {
                    global $woocommerce;
                    $etConf['checkoutUrl'] = esc_url( wc_get_cart_url() );
                } 
    
                wp_dequeue_script('prettyPhoto-init' );
    
                $gcaptcha = etheme_get_option('google_captcha_site');
    
                if ( $gcaptcha ) {
                    wp_enqueue_script('et_g-recaptcha', 'https://www.google.com/recaptcha/api.js?onload=CaptchaCallback&render=explicit',$script_depends,false,true );
                }
    
                wp_localize_script( 'etheme', 'etConfig', $etConf);
    
            }
        }

    Regards

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.