Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Luehrsen committed Sep 25, 2019
2 parents 0d10d05 + 1972746 commit 4beedbd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 4 additions & 7 deletions build/plugin-compatibility/woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,21 @@ class_exists( 'WooCommerce' )
return $options;
}

// Do not preload 'add to cart' links.
$wc_ignores[] = preg_quote( 'add-to-cart=', '/' );

// Do not preload the 'my account' page, as it is usually ressource heavy.
$myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
if ( $myaccount_page_id ) {
$wc_ignores[] = '^' . preg_quote( get_permalink( $myaccount_page_id ), '/' );
}

// Do not preload the cart, as it is usally ressource heavy.
$wc_ignores[] = '^' . preg_quote( $woocommerce->cart->get_cart_url(), '/' );
$wc_ignores[] = '^' . preg_quote( wc_get_cart_url(), '/' );

// Do not preload the checkout url for the same reason as above.
$wc_ignores[] = '^' . preg_quote( $woocommerce->cart->get_checkout_url(), '/' );
$wc_ignores[] = '^' . preg_quote( wc_get_checkout_url(), '/' );

// Do not preload the 'Payment' page, as it is usually ressource heavy.
if ( woocommerce_get_page_id( 'pay' ) ) {
$wc_ignores[] = '^' . preg_quote( get_permalink( woocommerce_get_page_id( 'pay' ) ), '/' );
if ( wc_get_page_id( 'pay' ) ) {
$wc_ignores[] = '^' . preg_quote( get_permalink( wc_get_page_id( 'pay' ) ), '/' );
}

// Remove possible empty strings and duplicates from the array.
Expand Down
3 changes: 3 additions & 0 deletions build/quicklink.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ function quicklink_enqueue_scripts() {

// Do not preload wp-content items (like downloads).
preg_quote( wp_parse_url( content_url(), PHP_URL_PATH ), '/' ),

// Do not preload links with get parameters.
'.*\?.+',
),
);

Expand Down

0 comments on commit 4beedbd

Please sign in to comment.