'Woocommerce child theme - overriding woocommerce support in child theme

I am using underscores as a parent theme. It declares Woocommerce support like this:

function _s_woocommerce_setup() {
add_theme_support(
    'woocommerce',
    array(
        'thumbnail_image_width' => 150,
        'single_image_width'    => 300,
        'product_grid'          => array(
            'default_rows'    => 3,
            'min_rows'        => 1,
            'default_columns' => 4,
            'min_columns'     => 1,
            'max_columns'     => 6,
        ),
    )
);
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );

}

How do I remove or override the settings in a child theme. For instance, I want the thumbnail width to be 300px for the child theme. How is this achieved? Can I remove theme support and re-add it?

And to clarify I have unsucessfully tried this:

function remove_parent_settings(){
remove_theme_support( 'thumbnail_image_width' );
remove_theme_support( 'gallery_thumbnail_image_width' );
remove_theme_support( 'single_image_width' ); } 

And then

add_action( 'after_setup_theme', 'remove_parent_settings', 99 );


Solution 1:[1]

Please add below code in child theme.

function mytheme_add_woocommerce_support() {
  add_theme_support( 'woocommerce' );
  add_theme_support( 'wc-product-gallery-zoom' );
  add_theme_support( 'wc-product-gallery-lightbox' );
  add_theme_support( 'wc-product-gallery-slider' );
}

add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );

Solution 2:[2]

Here is the Posix specification for time zone names: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03

For "UNK-4", the "UNK" is the time zone abbreviation (designation in Posix-speak) and -4 is the offset and means 4h east of the prime meridian. Note that the sign of the offset is opposite what everyone else uses, including other parts of Posix.

To differentiate between the abbreviation and the offset, the abbreviation must be all alphabetic characters.

However if you would like the abbreviation to contain non-alphabetic characters, the Posix spec says that you can quote the abbreviation with a leading '<' and a trailing '>'.

  • In the quoted form, the first character shall be the ( '<' ) character and the last character shall be the ( '>' ) character. All characters between these quoting characters shall be alphanumeric characters from the portable character set in the current locale, the ( '+' ) character, or the ( '-' ) character. The std and dst fields in this case shall not include the quoting characters.

So with "<+04>-4", the abbreviation is "+04", while the offset remains 4h east.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dotsquares
Solution 2 Howard Hinnant