Viewing 6 replies - 1 through 6 (of 6 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    There is likely a plugin or theme conflict causing this. Temporarily disable all other plugins except for WooCommerce, and switch to a default theme and test to see if this still happens. If it is solved at this point, start to enable features until you see it happening again. More info: https://docs.woocommerce.com/document/woocommerce-self-service-guide/#section-4

    Thread Starter umar25

    (@umar25)

    Thank you for your reply, i did tried.

    i would like to add that when i added this:

    add_filter('woocommerce_cod_icon', 'change_my_icons');
    function change_my_icons( $icons ) {
    	$icons['cod'] = <img src="the image path " height="20" />;
    	
      return $icons;
    }

    to functions.php, i get rid of “Array”, however i get a broken image and the alt text? (i do got the image png and svg, and the path is correct)

    any ideas?

    • This reply was modified 8 years, 1 month ago by umar25.
    • This reply was modified 8 years, 1 month ago by umar25.
    • This reply was modified 8 years, 1 month ago by umar25.
    • This reply was modified 8 years, 1 month ago by umar25.
    • This reply was modified 8 years, 1 month ago by Steven Stern (sterndata).
    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    The array() text showed up when only the WooCommerce plugin was active along with a default WordPress theme in use? That seems fairly unlikely as everybody else using this payment gateway isn’t seeing this error. Could you take a screenshot of this happening with the above conditions? (Only WC active and a default WP theme).

    And then if it does still happen, have you made any code edits to the WooCommerce plugin itself, or do you have snippets like the above one anywhere else?

    _______

    As for the code snippet, that is incorrect use of the filter. Just need to return a string:

    
    add_filter( 'woocommerce_cod_icon', 'change_cod_gateway_icon' );
    function change_cod_gateway_icon() {
    	return '<img src="https://pathtoimage.com/image.png" height="20" />';
    }
    
    Thread Starter umar25

    (@umar25)

    thank you for getting back to me on this, and am sorry for the confusion, the plugin is working fine with the default theme, after installing custom theme and translating it to arabic that text showed up.

    this Array text shows up for: cod, bank transfer, and cheque options.

    as for the code you gave me, the result is:
    https://drive.google.com/open?id=1V0jEYxusiSxMP9r1TxNsR1a8UYqBaJLw

    Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Oh, my bad. So you only want to return the image source with that filter:

    
    add_filter( 'woocommerce_cod_icon', 'change_cod_gateway_icon' );
    function change_cod_gateway_icon() {
    	return 'https://s.w.org/images/home/screen-themes.png?3';
    }
    

    You would do all of the markup if using this filter: https://github.com/woocommerce/woocommerce/blob/28a4e88811abd53280cc05f20067ce26e54826e4/includes/abstracts/abstract-wc-payment-gateway.php#L306

    Thread Starter umar25

    (@umar25)

    thank you very much,

    problem solved, heros saved the day 🙂

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

The topic ‘Extra text on cod payment option’ is closed to new replies.