Skip to content

Commit

Permalink
[2.5] Compatibility with w3 total cache inline minification
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejolley committed Jan 25, 2016
1 parent a550c77 commit 5db85c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions assets/js/frontend/add-to-cart-variation.js
Expand Up @@ -181,13 +181,23 @@
$form.wc_variations_image_update( variation );

// Output correct templates
var $template_html = '';

if ( ! variation.variation_is_visible ) {
$single_variation.html( unavailable_template );
$template_html = unavailable_template;
// w3 total cache inline minification adds CDATA tags around our HTML (sigh)
$template_html = $template_html.replace( '/*<![CDATA[*/', '' );
$template_html = $template_html.replace( '/*]]>*/', '' );
$single_variation.html( $template_html );
$form.find( 'input[name="variation_id"], input.variation_id' ).val( '' ).change();
} else {
$single_variation.html( template( {
$template_html = template( {
variation: variation
} ) );
} );
// w3 total cache inline minification adds CDATA tags around our HTML (sigh)
$template_html = $template_html.replace( '/*<![CDATA[*/', '' );
$template_html = $template_html.replace( '/*]]>*/', '' );
$single_variation.html( $template_html );
$form.find( 'input[name="variation_id"], input.variation_id' ).val( variation.variation_id ).change();
}

Expand Down
2 changes: 1 addition & 1 deletion assets/js/frontend/add-to-cart-variation.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5db85c6

Please sign in to comment.