How to resolve “PHP Notice: Undefined index: width in class-wc-regenerate-images.php on line 276”

After recent Woocommerce update on some website the PHP notice is appeared, like: PHP Notice: Undefined index: width in plugins/woocommerce/includes/class-wc-regenerate-images.php on line 276 PHP Notice: Undefined index: height in plugins/woocommerce/includes/class-wc-regenerate-images.php on line 277 This problem is caused by SVG-files mostly. So when in Woocommerce fucntion such mime type is checked some SVG images can has such structure, which call the php notice: Array ( [filesize] => 4427 ) How to fix Add this to you functions.php or other included to theme file: /** * Disable Woocommerce resize for SVG images. */ add_filter( 'wp_get_attachment_image_src', 'fix_wp_get_attachment_image_svg', 10, 4 ); function fix_wp_get_attachment_image_svg($image, $attachment_id, $size, $icon) { // if Woocommerce enabled if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { $attachment = get_post($attachment_id); $mime_type = $attachment->post_mime_type; // The attachment mime_type if($mime_type == 'image/svg+xml') { return false; ...
Read More

How to make email notifications of new product for Woocommerce

Sometimes if you're selling some products which are highly demand by customers such feature like notifications to email regarding new items listed for sale in your Woocommerce store can be very useful. This an easy way to make these notifications available for subscribers: Go to https://feedburner.google.com and add the RSS feed for your products (you should have Google account registered). The correct feed for your domain will be like: https://yourdomain.com/feed/?post_type=product Also you can previously check feed for your woocommerce shop online here:https://validator.w3.org/feed/ On the next screen you can set up the Title and feed name. It's up to your opinion. Now your feed is ready. Let's add subscribe form to get possibility for customers sign up to receive your Woocommerce store new listings updates. Go to the next screen, then one else and press menu point "Publicize". Press "activate" at the bottom of screen and then you'll be able to grab or HTML-code of subscription form, or HTML-code of link to sign up for emails. The code of form...
Read More