Hide style attribute add_to_cart shortcode when is empty

closes #9694
This commit is contained in:
Claudio Sanches 2015-11-25 12:26:58 -02:00
parent 853c3b23dc
commit 5f46968f8c
1 changed files with 3 additions and 1 deletions

View File

@ -452,9 +452,11 @@ class WC_Shortcodes {
return ''; return '';
} }
$styles = empty( $atts['style'] ) ? '' : ' style="' . esc_attr( $atts['style'] ) . '"';
ob_start(); ob_start();
?> ?>
<p class="product woocommerce add_to_cart_inline <?php echo esc_attr( $atts['class'] ); ?>" style="<?php echo esc_attr( $atts['style'] ); ?>"> <p class="product woocommerce add_to_cart_inline <?php echo esc_attr( $atts['class'] ); ?>"<?php echo $styles; ?>>
<?php if ( 'true' == $atts['show_price'] ) : ?> <?php if ( 'true' == $atts['show_price'] ) : ?>
<?php echo $product->get_price_html(); ?> <?php echo $product->get_price_html(); ?>