Skip to content

Commit ef80cd8

Browse files
committed
Fix access to the parent triggers security error "CORS" in wordpress.org preview
1 parent 74ba9c7 commit ef80cd8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

assets/js/src/custom.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,16 +1813,16 @@ botiga.misc = {
18131813
}
18141814
},
18151815
customizer: function() {
1816-
if( ! window.parent.document.body.classList.contains( 'wp-customizer' ) ) {
1816+
if ( typeof wp === 'undefined' || typeof wp.customize === 'undefined' ) {
18171817
return false;
18181818
}
18191819

1820-
window.onload = function() {
1820+
wp.customize.bind( 'preview-ready', function() {
18211821
var cart_count = document.querySelectorAll( '.cart-count' );
18221822
if( cart_count.length ) {
18231823
jQuery( document.body ).trigger( 'wc_fragment_refresh' );
18241824
}
1825-
}
1825+
} );
18261826
}
18271827
}
18281828

0 commit comments

Comments
 (0)