Update condition
This commit is contained in:
parent
38ac7e4ac0
commit
5794a9cb34
|
@ -919,7 +919,7 @@ class WC_Cart extends WC_Legacy_Cart {
|
|||
foreach ( $taxes as $key => $tax ) {
|
||||
$code = WC_Tax::get_rate_code( $key );
|
||||
|
||||
if ( $code || apply_filters( 'woocommerce_cart_remove_taxes_zero_rate_id', 'zero-rated' ) === $key ) {
|
||||
if ( $code || $key === apply_filters( 'woocommerce_cart_remove_taxes_zero_rate_id', 'zero-rated' ) ) {
|
||||
if ( ! isset( $tax_totals[ $code ] ) ) {
|
||||
$tax_totals[ $code ] = new stdClass();
|
||||
$tax_totals[ $code ]->amount = 0;
|
||||
|
@ -1382,7 +1382,7 @@ class WC_Cart extends WC_Legacy_Cart {
|
|||
* @return bool
|
||||
*/
|
||||
public function needs_shipping_address() {
|
||||
return apply_filters( 'woocommerce_cart_needs_shipping_address', $this->needs_shipping() === true && ! wc_ship_to_billing_address_only() );
|
||||
return apply_filters( 'woocommerce_cart_needs_shipping_address', true === $this->needs_shipping() && ! wc_ship_to_billing_address_only() );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -308,7 +308,7 @@ class WC_Form_Handler {
|
|||
$order_id = absint( $wp->query_vars['order-pay'] );
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
if ( $order->get_id() == $order_id && $order->get_order_key() == $order_key && $order->needs_payment() ) {
|
||||
if ( $order_id === $order->get_id() && $order_key === $order->get_order_key() && $order->needs_payment() ) {
|
||||
|
||||
do_action( 'woocommerce_before_pay_action', $order );
|
||||
|
||||
|
@ -351,7 +351,7 @@ class WC_Form_Handler {
|
|||
$available_gateways[ $payment_method ]->validate_fields();
|
||||
|
||||
// Process
|
||||
if ( wc_notice_count( 'error' ) == 0 ) {
|
||||
if ( 0 === wc_notice_count( 'error' ) ) {
|
||||
|
||||
$result = $available_gateways[ $payment_method ]->process_payment( $order_id );
|
||||
|
||||
|
@ -540,7 +540,7 @@ class WC_Form_Handler {
|
|||
// Sanitize
|
||||
$quantity = apply_filters( 'woocommerce_stock_amount_cart_item', wc_stock_amount( preg_replace( "/[^0-9\.]/", '', $cart_totals[ $cart_item_key ]['qty'] ) ), $cart_item_key );
|
||||
|
||||
if ( '' === $quantity || $quantity == $values['quantity'] ) {
|
||||
if ( '' === $quantity || $quantity === $values['quantity'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -747,12 +747,12 @@ class WC_Form_Handler {
|
|||
}
|
||||
|
||||
// If we added the product to the cart we can now optionally do a redirect.
|
||||
if ( $was_added_to_cart && wc_notice_count( 'error' ) === 0 ) {
|
||||
if ( 0 === $was_added_to_cart && wc_notice_count( 'error' ) ) {
|
||||
// If has custom URL redirect there
|
||||
if ( $url = apply_filters( 'woocommerce_add_to_cart_redirect', $url ) ) {
|
||||
wp_safe_redirect( $url );
|
||||
exit;
|
||||
} elseif ( get_option( 'woocommerce_cart_redirect_after_add' ) === 'yes' ) {
|
||||
} elseif ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) {
|
||||
wp_safe_redirect( wc_get_cart_url() );
|
||||
exit;
|
||||
}
|
||||
|
@ -769,7 +769,7 @@ class WC_Form_Handler {
|
|||
$quantity = empty( $_REQUEST['quantity'] ) ? 1 : wc_stock_amount( $_REQUEST['quantity'] );
|
||||
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity );
|
||||
|
||||
if ( $passed_validation && WC()->cart->add_to_cart( $product_id, $quantity ) !== false ) {
|
||||
if ( $passed_validation && false !== WC()->cart->add_to_cart( $product_id, $quantity ) ) {
|
||||
wc_add_to_cart_message( array( $product_id => $quantity ), true );
|
||||
return true;
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ class WC_Form_Handler {
|
|||
// Suppress total recalculation until finished.
|
||||
remove_action( 'woocommerce_add_to_cart', array( WC()->cart, 'calculate_totals' ), 20, 0 );
|
||||
|
||||
if ( $passed_validation && WC()->cart->add_to_cart( $item, $quantity ) !== false ) {
|
||||
if ( $passed_validation && false !== WC()->cart->add_to_cart( $item, $quantity ) ) {
|
||||
$was_added_to_cart = true;
|
||||
$added_to_cart[ $item ] = $quantity;
|
||||
}
|
||||
|
@ -894,7 +894,7 @@ class WC_Form_Handler {
|
|||
// Add to cart validation
|
||||
$passed_validation = apply_filters( 'woocommerce_add_to_cart_validation', true, $product_id, $quantity, $variation_id, $variations );
|
||||
|
||||
if ( $passed_validation && WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations ) !== false ) {
|
||||
if ( $passed_validation && false !== WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, $variations ) ) {
|
||||
wc_add_to_cart_message( array( $product_id => $quantity ), true );
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue