• I’ve been using WooCommerce and WPMU CustomPress for months without issues.

    When I upgraded yesterday to the latest version of WooCommerce, my checkout started to hang and won’t let users checkout.

    The error is with checkout.min.js:
    “Uncaught TypeError: Cannot read property ‘reload’ of null”

    When I look at checkout.min.js I find this, but I don’t know why it’s breaking (line 307 in the non-minified version):
    “catch(e){if(“true”===d.reload)return void window.location.reload();”

    I’ve tried reverting back to the previous checkout.min.js version, but that made things worse.

    I’ve gone through every plugin and the only one that makes a difference is CustomPress, but CustomPress didn’t change – WooCommerce did.

    I’ve gone to WPMU and they point back to the checkout.min.js file as well.

    Please help – my customers cannot checkout.

    https://www.ads-software.com/plugins/woocommerce/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Is there solution for that? Got the same problem and it may be related to Woocommerce Points & Rewards plugin: https://www.woothemes.com/products/woocommerce-points-and-rewards/

    The problem appears when I apply discount with these points.

    Thread Starter Tim W

    (@twalker123)

    I never got a response, so I had to get rid of CustomPress and write my own CPT code. Both companies charge for support and neither one provided it.

    Could you share the code, please?

    Thread Starter Tim W

    (@twalker123)

    I’ve done several of them at this point, but here’s one we use for testimonials. I put the code in a plugin called nuggetweb-testimonials and I broke up the code in several files so it would be easier to maintain:

    nuggetweb-testimonials.php

    <?php
    /*
    Plugin Name: NuggetWeb Testimonials
    Plugin URI: https://NuggetWeb.com
    Description: Adds Testimonials post type to the NuggetWeb website.
    Version: 1.0
    Author: NuggetWeb.com
    Author URI: https://nuggetweb.com
    License: GPLv2
    */
    
    function testimonial_post_init() {
        $nw_post_type = array(
              'labels' => array (
                'name' => 'Testimonials',
                'singular_name' => 'Testimonial',
                'add_new_item' => 'Add New Testimonial',
                'edit_item' => 'Edit Testimonial',
                'new_item' => 'New Testimonial',
                'view_item' => 'View Testimonial',
                'search_items' => 'Search Testimonials',
                'not_found' => 'No Testimonials found',
                'not_found_in_trash' => 'No Testimonials found in trash',
              ),
              'taxonomies' => array('category'),
              'supports' =>
              array (
                'title' => 'title',
                'editor' => 'editor',
                'thumbnail' => 'thumbnail',
                'excerpt' => 'excerpt',
                //'trackbacks' => 'trackbacks',
                'custom_fields' => 'custom-fields',
                //'comments' => 'comments',
                'revisions' => 'revisions',
                'page_attributes' => 'page-attributes',
                'post_formats' => 'post-formats',
              ),
              'supports_reg_tax' =>
              array (
                'category' => '1',
                'post_tag' => '1',
              ),
              'capability_type' => 'post',
              'map_meta_cap' => true,
              'description' => 'Client Testimonials',
              'menu_position' => 20,
              'public' => true,
              'hierarchical' => false,
              'has_archive' => true,
              'rewrite' =>
              array (
                'with_front' => true,
                'feeds' => false,
                'pages' => true,
                'ep_mask' => 0,
              ),
              'query_var' => true,
              'can_export' => true,
              'cf_columns' => NULL,
              );
        register_post_type( 'testimonial', $nw_post_type );
    }
    add_action( 'init', 'testimonial_post_init' );
    
    function nuggetweb_remove_post_meta($post) {
        // Remove catagory from single post template
        if ( (get_post_type() == 'testimonial') && (is_single()) ) {
            ?>
            <style>div.post-meta { display: none; }
            <?php
        }
    }
    add_action('wp_head', 'nuggetweb_remove_post_meta');
    
    include 'nuggetweb-taxonomies.php';
    include 'nuggetweb-custom-metabox.php';
    /* include 'maps/nuggetweb-js.php';
    include 'nuggetweb-maps.php';  */
    
    ?>

    nuggetweb-taxonomies.php

    <?php
    
    // Add product types taxonomy
    function nuggetweb_custom_taxonomy() {
        // Taxonomies Export code for CustomPress
    
        $labels = array(
    		'name'              => 'Testimonial Types',
    		'singular_name'     => 'Testimonial Type',
    		'search_items'      => 'Search Testimonial Types',
    		'all_items'         => 'All Testimonial Types',
    		'parent_item'       => 'Parent Testimonial Type',
    		'parent_item_colon' => 'Parent Testimonial Type:',
    		'edit_item'         => 'Edit Testimonial Type',
    		'update_item'       => 'Update Testimonial Type',
    		'add_new_item'      => 'Add New Testimonial Type',
    		'new_item_name'     => 'New Testimonial Type',
    		'menu_name'         => 'Testimonial Types',
            'popular_items'     => 'Popular Testimonial Types',
            'add_or_remove_items'        => 'Add or remove testimonial Types',
            'separate_items_with_commas' => 'Separate testimonial types with commas',
            'choose_from_most_used'      => 'All testimonial Types',
    	);
    
    	$args = array(
    		'hierarchical'      => true,
    		'labels'            => $labels,
    		'show_ui'           => true,
    		'show_admin_column' => true,
    		'query_var'         => true,
    		'rewrite'           => array( 'slug' => 'testimonial-types' ),
    	);
        register_taxonomy( 'testimonial-types', array( 'testimonial' ), $args );
    }
    add_action( 'init', 'nuggetweb_custom_taxonomy', 0 );
    
    ?>

    nuggetweb-custom-metabox.php

    <?php
    
    /**
     * Adds a box to the main column on the post edit screens.
     */
    
    include 'include/nuggetweb-add-custom-metabox.php';
    
    /**
     * HTML for metaboxes on post add/edit screen.
     */
    
    include 'include/nuggetweb-show-custom-metabox.php';
    
    /**
     * Saves meta data
     */
    include 'include/nuggetweb-save-custom-metabox.php';
    
    ?>

    includes/nuggetweb-add-custom-metabox.php

    <?php
    
    function nuggetweb_add_custom_meta_box() {
        $nuggetweb_arrays = nuggetweb_get_array();
    
        foreach ($nuggetweb_arrays as $key => $arr ) {
            nuggetweb_add_custom_meta_box_function($key,$arr[0],$arr[1]);
        }
    }
    add_action( 'add_meta_boxes', 'nuggetweb_add_custom_meta_box' );
    
    function nuggetweb_add_custom_meta_box_function($id, $title, $callback) {
        $screen = 'testimonial';
        add_meta_box(
            $id,
            $title,
            $callback,
            $screen, // $page
            'normal', // $context
            'high' // $priority
    		);
    }
    
    function nuggetweb_get_array() {
        $nuggetweb_temp_array = array(  'nuggetweb_website_text'  => array('Website URL','show_custom_meta_box_website'),
                                  );
        return $nuggetweb_temp_array;
    }
    
    ?>

    includes/nuggetweb-save-custom-metabox.php

    <?php
    
    /**
     * When the post is saved, saves our custom data.
     *
     * @param int $post_id The ID of the post being saved.
     */
    function nuggetweb_save_testimonial_data( $post_id ) {
    
    	/*
    	 * We need to verify this came from our screen and with proper authorization,
    	 * because the save_post action can be triggered at other times.
    	 */
    
    	// Check if our nonce is set.
    	if ( ! isset( $_POST['website_nonce'] ) ) {
            return;
    	}
    
    	// Verify that the nonce is valid.
    	if ( ! wp_verify_nonce( $_POST['website_nonce'], 'nuggetweb_website_text' ) ) {
    		return;
    	}
    
    	// If this is an autosave, our form has not been submitted, so we don't want to do anything.
    	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
    		return;
    	}
    
    	// Check the user's permissions.
    	if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
    
    		if ( ! current_user_can( 'edit_page', $post_id ) ) {
    			return;
    		}
    
    	} else {
    
    		if ( ! current_user_can( 'edit_post', $post_id ) ) {
    			return;
    		}
    	}
    
    	/* OK, it's safe for us to save the data now. */
        $nuggetweb_arrays = nuggetweb_get_array();
    
        foreach ($nuggetweb_arrays as $key => $arr ) {
            //error_log("Saving \$key = $key, \$arr[1] = $arr[1], values = $_POST[$arr[1]]",0);
            nuggetweb_add_custom_save_box_function($key,$post_id);
        }
    
    }
    add_action( 'save_post', 'nuggetweb_save_testimonial_data' );
    
    function nuggetweb_add_custom_save_box_function($nuggetweb_field,$post_id) {
        if (! isset( $_POST[$nuggetweb_field] ))  {
    		//return;
    	}
        else {
            // Sanitize user input.
            $my_data = sanitize_text_field( $_POST[$nuggetweb_field] );
    
            // Update the meta field in the database.
    	    update_post_meta( $post_id, $nuggetweb_field, $my_data );
        }
    }
    ?>

    includes/nuggetweb-show-custom-metabox.php

    <?php
    
    function show_custom_meta_box_website( $post ) {
    
    	// Add an nonce field so we can check for it later.
    	wp_nonce_field( 'nuggetweb_website_text', 'website_nonce' );
    
    	/*
    	 * Use get_post_meta() to retrieve an existing value
    	 * from the database and use the value for the form.
    	 */
        $website = get_post_meta( $post->ID, 'nuggetweb_website_text', true );
    
    	echo '<label for="nuggetweb_website_text">';
    	_e( 'Address Line One', 'myplugin_textdomain' );
    	echo '</label> ';
    	echo '<input type="text" id="nuggetweb_website_text" name="nuggetweb_website_text" value="' . esc_attr( $website ) . '" size="25" />';
    }
    
    ?>

    I hope that helps!

    Hi Tim,

    Thank you for the code!

    I’ve gone through all your code but found no relation to the checkout page or the issues?

    Can you explain a bit?

    Regards,
    Chris.

    Thread Starter Tim W

    (@twalker123)

    I wish I could explain, but nobody ever got back to me to tell me what the problem was, which is why I coded it myself.

    Tim

    Thread Starter Tim W

    (@twalker123)

    My best guess is that they tried to use incompatible javascript code, so when I took CustomPress out of the loop it was fine.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hanging on checkout’ is closed to new replies.