tweak to use product class function instead of body class function
This commit is contained in:
parent
5ba6ff1dac
commit
52ec35cab6
File diff suppressed because one or more lines are too long
|
@ -1926,12 +1926,10 @@ p.demo_store {
|
|||
}
|
||||
|
||||
/* added to get around variation image flicker issue */
|
||||
.woocommerce.single-product.has-default-attributes {
|
||||
div.product {
|
||||
.product.has-default-attributes {
|
||||
> .images {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue