• Resolved BARTNKCMO

    (@bartnkcmo)


    Has anyone had an issue with woocommerce checkout pages just sitting there spinning and not letting you proceed to finish the transaction?

    Also I am noticing that after you add things to the child theme functions.php that alot of times the inserted code does not work half the time. Could this be a cache issue?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Always worth clearing cache as first check.

    Thread Starter BARTNKCMO

    (@bartnkcmo)

    No luck so far .. Is the Enque function still considered relevant in the child theme and if so should it be placed in the functions.php or using the @import in style.css for this theme ?

    `add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

    }`

    Hi,

    You don’t need those codes in functions.php

    If it’s not a cache issue, then your issue is most likely a plugin conflict or a javascript conflict.

    You can troubleshoot by disabling other plugins, leaving only woocommerce plugin.

    You can also check your server error log for any parse error, fatal error, or memory exhaust.

    You can also go to woocommerce -> system status, to look for any clues.

    Thanks!

    Thread Starter BARTNKCMO

    (@bartnkcmo)

    Tried all of the above. Plugins are fine and everything seems to be fine in the woocommerce status.. Will check server error logs

    Thread Starter BARTNKCMO

    (@bartnkcmo)

    Ok so it seems to work in the parent Customizer theme with all plugins working and no conflicts. Child theme just sits and spins with or without plugins on or off…

    Here is what the Child theme looks like along with my functions file…

    /*
    Theme Name:     Customizr Child
    Theme URI:      http://***********radio.com/customizr-child/
    Description:    A child theme for the Customizr WordPress theme. This child theme simply includes 2 files : style.css to add your custom css and functions.php where you can extend Customizr's core code. In order to keep your code as clean and flexible as possible, try to use Customizr's hooks API for your customizations. Do something awesome and have fun !
    Author:         Nicolas Guillaume (nikeo)
    Author URI:     http://***********radio.com/
    Template:       customizr
    Version:        1.0.0
    */
    
    /* Your awesome customizations start right here !
    -------------------------------------------------------------- */
    .navbar .nav .my-nav-menu-search {
    float: right;
    }
    <?php
    /**
    * This is where you can copy and paste your functions !
    */
    // As of 3.1.10, Customizr doesn't output an html5 form.
    add_theme_support( 'html5', array( 'search-form' ) );
    add_filter('wp_nav_menu_items', 'add_search_form_to_menu', 10, 2);
    function add_search_form_to_menu($items, $args) {
      // If this isn't the main navbar menu, do nothing
      if( !($args->theme_location == 'main') ) // with Customizr Pro 1.2+ and Cusomizr 3.4+ you can chose to display the saerch box to the secondary menu, just replacing 'main' with 'secondary'
        return $items;
      // On main menu: put styling around search and append it to the menu items
      return $items . '<li class="my-nav-menu-search">' . get_search_form(false) . '</li>';
    }
    /**
     * woocommerce_package_rates is a 2.1+ hook
     */
    add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
    
    /**
     * Hide shipping rates when free shipping is available
     *
     * @param array $rates Array of rates found for the package
     * @param array $package The package array/object being shipped
     * @return array of modified rates
     */
    function hide_shipping_when_free_is_available( $rates, $package ) {
    
     	// Only modify rates if free_shipping is present
      	if ( isset( $rates['free_shipping'] ) ) {
    
      		// To unset a single rate/method, do the following. This example unsets flat_rate shipping
      		unset( $rates['flat_rate'] );
    
      		// To unset all methods except for free_shipping, do the following
      		$free_shipping          = $rates['free_shipping'];
      		$rates                  = array();
      		$rates['free_shipping'] = $free_shipping;
    	}
    
    	return $rates;
    }
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    function custom_override_checkout_fields( $fields ) {
    unset($fields['billing']['billing_first_name']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_address_1']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_city']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_country']);
    unset($fields['billing']['billing_state']);
    unset($fields['billing']['billing_phone']);
    unset($fields['order']['order_comments']);
    unset($fields['billing']['billing_address_2']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_email']);
    unset($fields['billing']['billing_city']);
    return $fields;
    }
    Thread Starter BARTNKCMO

    (@bartnkcmo)

    Ok switched themes to something completely different and all is well. Even though this has not been resolved I will mark it as so.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Woocommerce and Functions.php’ is closed to new replies.