From 8ca18f06ad00a471d836d47c839d37940c7dc55e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20=C3=9Cnalan?= Date: Thu, 19 Sep 2024 15:26:06 +0300 Subject: [PATCH 1/2] Marketplace: hide the scrollbar from the category selector (#51527) * Marketplace: hide the scrollbar from the category selector Also fixed some button gradient issues * Marketplace: change scroll helper button cursor * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions --- .../components/category-selector/category-selector.scss | 6 +++++- .../changelog/51527-update-in-app-category-scrollbar | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/51527-update-in-app-category-scrollbar diff --git a/plugins/woocommerce-admin/client/marketplace/components/category-selector/category-selector.scss b/plugins/woocommerce-admin/client/marketplace/components/category-selector/category-selector.scss index 952780f05e2..e0def897abe 100644 --- a/plugins/woocommerce-admin/client/marketplace/components/category-selector/category-selector.scss +++ b/plugins/woocommerce-admin/client/marketplace/components/category-selector/category-selector.scss @@ -6,6 +6,7 @@ align-items: stretch; margin: 0; overflow-x: auto; + scrollbar-width: none; } .woocommerce-marketplace__category-item { @@ -132,15 +133,18 @@ top: 0; bottom: 0; height: 100%; - width: 50px; + width: 100px; + cursor: pointer; } .woocommerce-marketplace__category-navigation-button--prev { background: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)); left: 0; + text-align: left; } .woocommerce-marketplace__category-navigation-button--next { background: linear-gradient(to left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0)); right: 0; + text-align: right; } diff --git a/plugins/woocommerce/changelog/51527-update-in-app-category-scrollbar b/plugins/woocommerce/changelog/51527-update-in-app-category-scrollbar new file mode 100644 index 00000000000..f7342ec51da --- /dev/null +++ b/plugins/woocommerce/changelog/51527-update-in-app-category-scrollbar @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +Fix marketplace category selector scrollbars and buttons \ No newline at end of file From bf549e6d8f45c15f9b390989d400f83169cc0f9c Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 19 Sep 2024 13:36:54 +0100 Subject: [PATCH 2/2] Defend against missing session in cart functions to prevent fatals (#51442) * Ensure session is callable in cart functions * Changelog --- .../fix-defend-against-missing-session-51237 | 4 +++ .../includes/wc-cart-functions.php | 28 ++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 plugins/woocommerce/changelog/fix-defend-against-missing-session-51237 diff --git a/plugins/woocommerce/changelog/fix-defend-against-missing-session-51237 b/plugins/woocommerce/changelog/fix-defend-against-missing-session-51237 new file mode 100644 index 00000000000..e37782b7f7b --- /dev/null +++ b/plugins/woocommerce/changelog/fix-defend-against-missing-session-51237 @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Ensure session is loaded in cart functions to prevent fatal errors. diff --git a/plugins/woocommerce/includes/wc-cart-functions.php b/plugins/woocommerce/includes/wc-cart-functions.php index d0a048d3bbb..91b74850d62 100644 --- a/plugins/woocommerce/includes/wc-cart-functions.php +++ b/plugins/woocommerce/includes/wc-cart-functions.php @@ -412,13 +412,13 @@ function wc_cart_round_discount( $value, $precision ) { * @return string[] */ function wc_get_chosen_shipping_method_ids() { - $method_ids = array(); - $chosen_methods = array(); - - if ( is_callable( array( WC()->session, 'get' ) ) ) { - $chosen_methods = WC()->session->get( 'chosen_shipping_methods', array() ); + if ( ! is_callable( array( WC()->session, 'get' ) ) ) { + return array(); } + $chosen_methods = WC()->session->get( 'chosen_shipping_methods', array() ); + $method_ids = array(); + foreach ( $chosen_methods as $chosen_method ) { if ( ! is_string( $chosen_method ) ) { continue; @@ -439,11 +439,15 @@ function wc_get_chosen_shipping_method_ids() { * @return string|bool Either the chosen method ID or false if nothing is chosen yet. */ function wc_get_chosen_shipping_method_for_package( $key, $package ) { - $chosen_methods = WC()->session->get( 'chosen_shipping_methods' ); + if ( ! is_callable( array( WC()->session, 'get' ) ) ) { + return false; + } + + $chosen_methods = WC()->session->get( 'chosen_shipping_methods', array() ); $chosen_method = isset( $chosen_methods[ $key ] ) ? $chosen_methods[ $key ] : false; $changed = wc_shipping_methods_have_changed( $key, $package ); - // This is deprecated but here for BW compat. TODO: Remove in 4.0.0. + // This is deprecated but here for BW compat. Remove in 4.0.0. $method_counts = WC()->session->get( 'shipping_method_counts' ); if ( ! empty( $method_counts[ $key ] ) ) { @@ -465,6 +469,12 @@ function wc_get_chosen_shipping_method_for_package( $key, $package ) { WC()->session->set( 'chosen_shipping_methods', $chosen_methods ); WC()->session->set( 'shipping_method_counts', $method_counts ); + /** + * Fires when a shipping method is chosen. + * + * @since 3.2.0 + * @param string $chosen_method Chosen shipping method. e.g. flat_rate:1. + */ do_action( 'woocommerce_shipping_method_chosen', $chosen_method ); } return $chosen_method; @@ -536,6 +546,10 @@ function wc_get_default_shipping_method_for_package( $key, $package, $chosen_met * @return bool */ function wc_shipping_methods_have_changed( $key, $package ) { + if ( ! is_callable( array( WC()->session, 'get' ) ) ) { + return false; + } + // Lookup previous methods from session. $previous_shipping_methods = WC()->session->get( 'previous_shipping_methods' ); // Get new and old rates.