Skip to content

Commit 8391bb0

Browse files
committed
Minor refactor
1 parent 1c3a14d commit 8391bb0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

modules/ecommerce/wc/class-swsales-module-wc.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,25 +253,25 @@ public static function create_coupon_ajax() {
253253
} // end create_discount_code_ajax()
254254

255255
/**
256-
* Returns whether the current page is the landing page
257-
* for the passed Sitewide Sale.
256+
* Returns whether the current page is the the checkout, cart or confirmation page.
258257
*
259258
* @param boolean $is_checkout_page current value from filter.
260259
* @param SWSales_Sitewide_Sale $sitewide_sale being checked.
261-
* @return boolean
260+
* @return boolean $is_checkout_page true if we are on the checkout, cart, or confirmation page, false otherwise.
262261
*/
263262
public static function is_checkout_page( $is_checkout_page, $sitewide_sale ) {
264263
if ( 'wc' !== $sitewide_sale->get_sale_type() ) {
265264
return $is_checkout_page;
266265
}
267266

268267
// Check for cart page.
269-
if ( ! empty( wc_get_page_id( 'cart' ) ) && is_page( wc_get_page_id( 'cart' ) ) ) {
268+
$is_cart_page = wc_get_page_id( 'cart' );
269+
if ( ! empty( $is_cart_page ) && is_page( $is_cart_page ) ) {
270270
return true;
271271
}
272272

273273
// Check for checkout page.
274-
if ( is_checkout() ) {
274+
if ( function_exists( 'is_checkout' ) && is_checkout() ) {
275275
return true;
276276
}
277277

0 commit comments

Comments
 (0)