Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Prepend CSS src with correct url scheme #10240

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/BlockTypes/ClassicTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Automattic\WooCommerce\Blocks\Templates\OrderConfirmationTemplate;
use Automattic\WooCommerce\Blocks\Utils\StyleAttributesUtils;
use WC_Shortcode_Checkout;
use WC_Frontend_Scripts;

/**
* Classic Single Product class
Expand Down Expand Up @@ -47,10 +48,17 @@ protected function initialize() {
public function enqueue_block_assets() {
// Ensures frontend styles for blocks exist in the site editor iframe.
if ( class_exists( 'WC_Frontend_Scripts' ) && is_admin() ) {
$frontend_scripts = new \WC_Frontend_Scripts();
$frontend_scripts = new WC_Frontend_Scripts();
$styles = $frontend_scripts::get_styles();

foreach ( $styles as $handle => $style ) {
wp_enqueue_style( $handle, $style['src'], $style['deps'], $style['version'], $style['media'] );
wp_enqueue_style(
$handle,
set_url_scheme( $style['src'] ),
$style['deps'],
$style['version'],
$style['media']
);
}
}
}
Expand All @@ -75,7 +83,7 @@ protected function render( $attributes, $content, $block ) {
* @see https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/5328#issuecomment-989013447
*/
if ( class_exists( 'WC_Frontend_Scripts' ) ) {
$frontend_scripts = new \WC_Frontend_Scripts();
$frontend_scripts = new WC_Frontend_Scripts();
$frontend_scripts::load_scripts();
}

Expand Down
Loading