phpcs
This commit is contained in:
parent
3c3894b676
commit
6c9f9ea424
|
@ -70,7 +70,6 @@ final class WC_Cart_Session {
|
|||
|
||||
$update_cart_session = false; // Flag to indicate the stored cart should be updated.
|
||||
$order_again = false; // Flag to indicate whether this is a re-order.
|
||||
|
||||
$cart = WC()->session->get( 'cart', null );
|
||||
$merge_saved_cart = (bool) get_user_meta( get_current_user_id(), '_woocommerce_load_saved_cart_after_login', true );
|
||||
|
||||
|
@ -121,7 +120,8 @@ final class WC_Cart_Session {
|
|||
} else {
|
||||
// Put session data into array. Run through filter so other plugins can load their own session data.
|
||||
$session_data = array_merge(
|
||||
$values, array(
|
||||
$values,
|
||||
array(
|
||||
'data' => $product,
|
||||
)
|
||||
);
|
||||
|
@ -148,7 +148,7 @@ final class WC_Cart_Session {
|
|||
|
||||
// If this is a re-order, redirect to the cart page to get rid of the `order_again` query string.
|
||||
if ( $order_again ) {
|
||||
wp_redirect( wc_get_page_permalink( 'cart' ) );
|
||||
wp_safe_redirect( wc_get_page_permalink( 'cart' ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +219,9 @@ final class WC_Cart_Session {
|
|||
public function persistent_cart_update() {
|
||||
if ( get_current_user_id() && apply_filters( 'woocommerce_persistent_cart_enabled', true ) ) {
|
||||
update_user_meta(
|
||||
get_current_user_id(), '_woocommerce_persistent_cart_' . get_current_blog_id(), array(
|
||||
get_current_user_id(),
|
||||
'_woocommerce_persistent_cart_' . get_current_blog_id(),
|
||||
array(
|
||||
'cart' => $this->get_cart_for_session(),
|
||||
)
|
||||
);
|
||||
|
@ -327,8 +329,10 @@ final class WC_Cart_Session {
|
|||
$cart_id = WC()->cart->generate_cart_id( $product_id, $variation_id, $variations, $cart_item_data );
|
||||
$product_data = wc_get_product( $variation_id ? $variation_id : $product_id );
|
||||
$cart[ $cart_id ] = apply_filters(
|
||||
'woocommerce_add_order_again_cart_item', array_merge(
|
||||
$cart_item_data, array(
|
||||
'woocommerce_add_order_again_cart_item',
|
||||
array_merge(
|
||||
$cart_item_data,
|
||||
array(
|
||||
'key' => $cart_id,
|
||||
'product_id' => $product_id,
|
||||
'variation_id' => $variation_id,
|
||||
|
@ -337,7 +341,8 @@ final class WC_Cart_Session {
|
|||
'data' => $product_data,
|
||||
'data_hash' => wc_get_cart_item_data_hash( $product_data ),
|
||||
)
|
||||
), $cart_id
|
||||
),
|
||||
$cart_id
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue