tweak to use product class function instead of body class function

This commit is contained in:
roykho 2015-10-02 10:26:53 +02:00
parent 5ba6ff1dac
commit 52ec35cab6
5 changed files with 10 additions and 16 deletions

File diff suppressed because one or more lines are too long

View File

@ -1926,11 +1926,9 @@ p.demo_store {
}
/* added to get around variation image flicker issue */
.woocommerce.single-product.has-default-attributes {
div.product {
> .images {
opacity: 0;
}
.product.has-default-attributes {
> .images {
opacity: 0;
}
}

View File

@ -141,7 +141,7 @@
}
// added to get around variation image flicker issue
$( '.single-product.has-default-attributes .product .images' ).fadeTo( 200, 1 );
$( '.product.has-default-attributes > .images' ).fadeTo( 200, 1 );
// Custom event for when variation selection has been changed
$form.trigger( 'woocommerce_variation_has_changed' );

File diff suppressed because one or more lines are too long

View File

@ -173,8 +173,6 @@ function wc_generator_tag( $gen, $type ) {
* @return array
*/
function wc_body_class( $classes ) {
global $post;
$classes = (array) $classes;
if ( is_woocommerce() ) {
@ -201,12 +199,6 @@ function wc_body_class( $classes ) {
$classes[] = 'woocommerce-demo-store';
}
$product = wc_get_product( $post->ID );
if ( is_product() && 'variable' === $product->product_type && $product->has_default_attributes() ) {
$classes[] = 'has-default-attributes';
}
foreach ( WC()->query->query_vars as $key => $value ) {
if ( is_wc_endpoint_url( $key ) ) {
$classes[] = 'woocommerce-' . sanitize_html_class( $key );
@ -316,6 +308,10 @@ function wc_product_post_class( $classes, $class = '', $post_id = '' ) {
}
}
if ( is_product() && 'variable' === $product->product_type && $product->has_default_attributes() ) {
$classes[] = 'has-default-attributes';
}
$classes[] = $product->stock_status;
}