Support » Plugin: WooCommerce » Undefined index

  • Resolved jleung1994

    (@jleung1994)


    Notice: Undefined index: priority in …/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1242

    Notice: Undefined index: priority in …/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1245

    Notice: Undefined index: priority in …/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1242

    Notice: Undefined index: priority in …/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 1245

    • This topic was modified 3 years, 4 months ago by jleung1994. Reason: add tags
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gerhard Potgieter

    (@kloon)

    Could you perhaps provide me with a bit more details on this? What theme are you using, what version of WooCommerce.

    Also can you test by switching to a default theme like Twentyseventeen or Storefront and test if you get the same notices?

    On another note you should be disabling notices and warning on a product site. Something like this placed in your wp-config.php file

    ini_set('log_errors','On');
    ini_set('display_errors','Off');
    ini_set('error_reporting', E_ALL );
    define('WP_DEBUG', false);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', false);
    Thread Starter jleung1994

    (@jleung1994)

    @kloon
    this only shows up on my testing site, where I have error display set to true
    on this test site, I use the latest version of woocommerce.
    I use custom storefront child theme.

    Also, it only shows up when I publish the product before setting the price, etc information about the product.

    • This reply was modified 3 years, 4 months ago by jleung1994. Reason: add information
    Plugin Author Mike Jolley

    (@mikejolley)

    This means you have a plugin or theme customising the product tabs, but they are failing to set a ‘priority’ for each tab.

    Workaround here https://github.com/woocommerce/woocommerce/pull/17521

    Thread Starter jleung1994

    (@jleung1994)

    @mikejolley
    Thank you. I didn’t understand the workaround page, but I found the solution here:
    https://docs.woocommerce.com/document/editing-product-data-tabs/

    I just need to add check if product has attributes, dimensions or weight in the theme functions.php and the error is gone.
    Not sure why the error I got looks different from the one explained on the link.

    add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
    
    function woo_rename_tabs( $tabs ) {
    
    	global $product;
    	
    	if( $product->has_attributes() || $product->has_dimensions() || $product->has_weight() ) { // Check if product has attributes, dimensions or weight
    		$tabs['additional_information']['title'] = __( 'Product Data' );	// Rename the additional information tab
    	}
     
    	return $tabs;
     
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Undefined index’ is closed to new replies.