• Resolved manualmode

    (@manualmode)


    Hello, everyone.

    I am using woocommerce poor guys swiss knife plugin, very good plugin with all the features i need.

    However, i found below codes in the plugin may cause some conflicts with woocommerce.

    function wcpgsk_clear_messages() {
    	if ( function_exists('WC') && function_exists('wc_clear_notices') ) :
    		wc_clear_notices();
    	else :
    		global $woocommerce;
    		$woocommerce->clear_messages();
    	endif;
    }

    I have to delete the IF part to avoid cart stock check issue. Have to keep the Function, otherwise causing error.

    function wcpgsk_clear_messages() {
    		global $woocommerce;
    }

    Below is the part of code in the plugin where i found the above code. Just wondering except above modification, is there any potential conflict with current version of woocommerce? Do i still need these codes in current version of woocommerce as it seems related to an old version of woommcerce (Handle functions deprecated in WooCommerce since 2.1.0 for WooCommerce installations < 2.1). Thanks.

    Not sure if it is proper to post plugin code here, feel free to delete if not allowed.

    /**
     * Handle functions deprecated in WooCommerce since 2.1.0 for WooCommerce installations < 2.1
     */
    function wcpgsk_add_error( $error ) {
    	if ( function_exists('WC') && function_exists('wc_add_notice') ) :
    		wc_add_notice( $error, 'error');
    	else :
    		global $woocommerce;
    		$woocommerce->add_error( $error );
    	endif;
    }
    
    function wcpgsk_add_message( $message ) {
    	if ( function_exists('WC') && function_exists('wc_add_notice') ) :
    		wc_add_notice( $message );
    	else :
    		global $woocommerce;
    		$woocommerce->add_message( $message );
    	endif;
    }
    
    function wcpgsk_clear_messages() {
    	if ( function_exists('WC') && function_exists('wc_clear_notices') ) :
    		wc_clear_notices();
    	else :
    		global $woocommerce;
    		$woocommerce->clear_messages();
    	endif;
    }
    
    function wcpgsk_show_messages() {
    	if ( function_exists('WC') && function_exists('wc_print_notices') ) :
    		wc_print_notices();
    	else :
    		global $woocommerce;
    		$woocommerce->show_messages();
    	endif;
    }
    
    function wcpgsk_set_messages() {
    	if ( !function_exists('WC') ) :
    		global $woocommerce;
    		$woocommerce->set_messages();
    	endif;
    }

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    You should be good to go, although it’d be best to check with the developers of that plugin to be absolutely certain.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    For latest WC, only wc_clear_notices(); should be used.

    Thread Starter manualmode

    (@manualmode)

    Hi, Riaan and Mike.
    Thanks for your reply.

    The developer seems removed the plugin/support from the wordpress.

    Hi Mike,

    Do you suggest to delete all other Functions? Only keep the following function right? I am using the latest WC.

    function wcpgsk_clear_messages() {
    		global $woocommerce;
    }

    Thanks a lot.
    Regards.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    I guess – it won’t do anything in that case.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Woocommerce poor guys swiss knife conflict?’ is closed to new replies.