Migration Guides
This area contains the Migration steps to follow for upgrading your store to new Front-Commerce versions.
To update Front-Commerce in your project, use the command below (with the exact version you need):
npm install git+ssh://git@gitlab.blackswift.cloud/front-commerce/front-commerce.git#2.33.0
2.34.0
-> 2.35.1
β
Version 2.35.1 marks the LTS version of Front-Commerce. As such, we have performed a thorough security audit of the codebase and fixed multiple security issues.
In order to benefit from the result of this audit, you will need to update your project. Please refer to the LTS version documentation for more information about the changes and their impact.
2.33.0
-> 2.34.0
β
Google Consent V2 Supportβ
In this release, we've added support for Google's Consent Mode v2 which provides more granular control over user consent preferences. This change affects applications using either the Google Analytics 4 or Google Tag Manager plugins.
To enable this feature, add the
consentOptions
to your service configuration in cookiesServices.js
You can also take advantage of the consentOptions
in your custom plugins by
following the
Granular Consent Updates
guide.
If you have overriden any of these files, please make sure you apply the changes to your overrides:
- theme/modules/Cookie/CookieLink/CookieLink.js
- theme/modules/Cookie/CookieModal/CookieModal.js
- theme/modules/Cookie/CookiePage/CookieGrid/CookieGrid.js
- theme/modules/Cookie/CookiePage/CookieLine/CookieLine.js
- theme/modules/Cookie/CookiePage/CookieLine/_CookieLine.scss
- theme/modules/Cookie/CookiePage/CookiePage.js
2.32.0
-> 2.33.0
β
No manual migration steps are required for this release.
2.31.0
-> 2.32.0
β
No manual migration steps are required for this release.
2.30.0
-> 2.31.0
β
No manual migration steps are required for this release.
2.29.0
-> 2.30.0
β
Fixed add to wishlist after new registrationβ
In this version we fixed the add to wishlist state updates after the first registration. Previously it would not display a product in the wishlist until a full page reload is initiated.
To accommodate this fix, we had to add changes to the following files;
- src/web/theme/modules/Wishlist/AddProductToWishlist/withIsProductInWishlist.js
- src/web/theme/modules/Wishlist/AddProductToWishlist/withProductWishlistMutations.js
If you have overridden these files please ensure to update them with the changes.
Reworked QuickOrder componentβ
In this version, we've introduced a new feature that enables you to bulk import products from a CSV file and directly add them to your cart.
The Quick order page is active by default at /quick-order
. If you want to
opt-out of this feature, you will have to remove the route
using the front-commerce-prepare.js::onCreateRoute
callback.
To develop this new feature, we've had to update the following files;
src/web/theme/modules/ProductPicker/ProductPicker.js
src/web/theme/modules/AddToCart/AddToCartModal/AddToCartModalQuery.gql
src/web/theme/modules/QuickOrder/QuickOrder.js
- https://gitlab.blackswift.cloud/front-commerce/front-commerce/-/commit/f2efb127286d4f17a5fb6d48d23fb32c0418e9be#a72de350cd94321d5b8db2bb90e500f068bb09c5
- https://gitlab.blackswift.cloud/front-commerce/front-commerce/-/commit/8171a6fde0aac903f3d4852466df072840ca3015#a72de350cd94321d5b8db2bb90e500f068bb09c5
src/web/theme/modules/QuickOrder/_QuickOrder.scss
Stripe integration now uses IPNs on Magento2 / Magento2 B2Bβ
In this version we've updated Stripe payment module to use IPNs. To cope with this change, you will need to ensure that:
- Stripe is configured to use an
asyncOrder
checkout flow
diff --git a/src/web/theme/pages/Checkout/checkoutFlowOf.js b/src/web/theme/pages/Checkout/checkoutFlowOf.js
index f7bd3222f..b843608da 100644
--- a/src/web/theme/pages/Checkout/checkoutFlowOf.js
+++ b/src/web/theme/pages/Checkout/checkoutFlowOf.js
@@ -11,6 +11,7 @@ const checkoutFlowOf = (method) => {
if (method.startsWith("hipay_")) return "directOrderWithAdditionalAction";
if (method === "payzen_embedded") return "asyncOrder";
+ if (method === "stripe") return "asyncOrder";
return "directOrder";
};
- In
StripeCheckout
component,cartId
is added to thepaymentData
object in the checkout state:
diff --git a/src/web/theme/modules/Checkout/Payment/AdditionalPaymentInformation/StripeCheckout/StripeCheckout.js b/src/web/theme/modules/Checkout/Payment/AdditionalPaymentInformation/StripeCheckout/StripeCheckout.js
index 5539c0c87..976f89594 100644
--- a/src/web/theme/modules/Checkout/Payment/AdditionalPaymentInformation/StripeCheckout/StripeCheckout.js
+++ b/src/web/theme/modules/Checkout/Payment/AdditionalPaymentInformation/StripeCheckout/StripeCheckout.js
@@ -41,6 +41,7 @@ const withData = compose(
loading: data.loading,
clientSecret:
!data.loading && data.cart?.stripe?.paymentIntent?.clientSecret,
+ cartId: !data.loading && data.cart?.id,
}),
})
),
@@ -101,6 +102,7 @@ const StripeCheckoutComponent = (props) => {
} else if (paymentIntent.status === "requires_capture") {
const paymentData = {
paymentIntentId: paymentIntent.id,
+ cartId: props.cartId,
};
setState({
loading: false,
Fixed multiple triggers of "Order Completed" analytics eventβ
In this version we've fixed the issue where the "Order Completed" event would be
triggered multiple times by refreshing the /checkout/success
page (see
related commit).
To benefit from this fix, you will need to ensure that the following changes have been applied to your project, in the case you overrode those files:
diff --git a/src/web/theme/modules/Checkout/withCheckoutTracking/withCheckoutSuccessTracking.js b/src/web/theme/modules/Checkout/
withCheckoutTracking/withCheckoutSuccessTracking.js
index 1f1cc1cd1..8fe9f3d61 100644
--- a/src/web/theme/modules/Checkout/withCheckoutTracking/withCheckoutSuccessTracking.js
+++ b/src/web/theme/modules/Checkout/withCheckoutTracking/withCheckoutSuccessTracking.js
@@ -6,6 +6,10 @@ import trackEvent from "theme/modules/Analytics/trackEvent";
import CheckoutSuccessTrackingQuery from "./CheckoutSuccessTrackingQuery.gql";
const trackCartOrdered = (order) => {
+ const shouldTrack = localStorage.getItem("trackOrderCompleted");
+ if (!shouldTrack) {
+ return;
+ }
try {
const formatItemForAnalytics = ({ sku, name, row_total, qty_ordered }) => ({
sku,
@@ -25,6 +29,7 @@ const trackCartOrdered = (order) => {
discount: order.totals.discount.value.amount,
products: order.items.map(formatItemForAnalytics),
});
+ localStorage.removeItem("trackOrderCompleted");
} catch (e) {
console.error(
"Failed to send successfull order to tracking. Does it have a valid format?"
diff --git a/src/web/theme/pages/Checkout/stepsDefinition.js b/src/web/theme/pages/Checkout/stepsDefinition.js
index d54db0f25..6d40d9ac4 100644
--- a/src/web/theme/pages/Checkout/stepsDefinition.js
+++ b/src/web/theme/pages/Checkout/stepsDefinition.js
@@ -170,17 +170,20 @@ const steps = [
isDisplayable: (checkoutState) => !!checkoutState.paymentMethod,
},
{
- renderStep: (props) => (
- <Redirect
- to={{
- pathname: "/checkout/success",
- state: {
- ...props.checkoutState.placedOrderData,
- checkoutState: props.checkoutState,
- },
- }}
- />
- ),
+ renderStep: (props) => {
+ localStorage.setItem("trackOrderCompleted", "true");
+ return (
+ <Redirect
+ to={{
+ pathname: "/checkout/success",
+ state: {
+ ...props.checkoutState.placedOrderData,
+ checkoutState: props.checkoutState,
+ },
+ }}
+ />
+ );
+ },
isValid: (checkoutState) => false,
isRelevant: () => true,
isDisplayable: (checkoutState) => checkoutState.isPlaced,
New features in 2.30.0
β
2.28.0
-> 2.29.0
β
No manual migration steps are required for this release.
2.27.0
-> 2.28.0
β
No manual migration steps are required for this release.
2.26.0
-> 2.27.0
β
Magento1: Reviewsβ
In this release, we added the ability to see and publish product reviews for Magento1. However, you will need to update your Front-Commerce Magento1 module to version 1.6.0 or above for this feature to work.
New features in 2.27.0
β
- An optimized implementation of
addMultipleItemsToCart
mutation for Magento2 - Review support for Magento1
2.25.0
-> 2.26.0
β
Requisition List UID Updateβ
In version 2.26.0, we have updated the behavior of the requisition list UID to align with the Magento 2 GraphQL API.
The requisition list UID is now a base64-encoded string instead of a decoded string value.
If you are using a Magento version lower than 2.4.5, you must update the requisition list module by running the following command:
composer require magento/module-requisition-list-graph-ql 1.3.3
We have added the
FRONT_COMMERCE_MAGENTO_UNSAFE_LEGACY_REQUISITION_LIST_ID=true
environment
variable for backward compatibility. However, please note that this variable
will be removed in version 3.0. To ensure future compatibility, we recommend
updating the Magento module instead of relying on this environment variable.
Configurable Axios Timeoutsβ
In this version, we have added the ability to configure the timeouts for the Axios instance used by Front-Commerce. We recommend using the new configuration instead of the timeout file with static values, which has been marked as deprecated for v3.0.
The loaders that previously used these values have been updated to use a
configProvider
to get the values, which are customizable via the following
environment variables:
- Magento1 configProvider
FRONT_COMMERCE_MAGENTO_TIMEOUT
(default: 60000)FRONT_COMMERCE_MAGENTO_ADMIN_TIMEOUT
(default: 10000)
- Magento2 configProvider
FRONT_COMMERCE_MAGENTO_TIMEOUT
(default: 60000)FRONT_COMMERCE_MAGENTO_ADMIN_TIMEOUT
(default: 10000)
- Colissimo configProvider
FRONT_COMMERCE_COLISSIMO_TIMEOUT
(default: 10000)
- Ogone configuration
FRONT_COMMERCE_OGONE_TIMEOUT
(default: 10000)
We hope this documentation helps you configure the timeouts for the Axios instance used by Front-Commerce. If you have any questions or concerns, please don't hesitate to contact us.
Redis invalidation SCAN iterations size configuration (invalidationScanIterationSize
)β
We've increased the default iterations size for SCAN
commands issued by the
Redis caching strategy
during cache invalidation with wildcards.
It used to be an arbitrary value of 100, and we increased it to 1000 to have better performances when invalidating cache on databases containing several millions of keys.
We feel it's a better default from our observations. This value is now
configurable, so if you want to tweak its value or go back to the previous
behavior, please update your caching.js
with the
invalidationScanIterationSize: 100
value.
New features in 2.26.0
β
- caching: the
PerMagentoCustomerTaxZone
caching strategy is now also available for Magento 1, to cache prices per tax zone (see documentation) - payment: Authorize.net is now supported for Magento1 (OpenMage LTS)
projects. To use it, please update the Magento module
front-commerce/magento1-module
to 1.5.0+
2.24.0
-> 2.25.0
β
Updated canonical URL creation methodβ
Breaking: In this version we have changed the way
QueryHelper.filterCanonicalQueryStringParameters
compute the canonical URL
parameters, in order to better fit SEO-recommended rules (see
Google article
on this matter).
To opt-in to this behaviour, you can pass a boolean as the second parameter of
QueryHelper.filterCanonicalQueryStringParameters
to configure whether or not
additional filters should be included in the canonical. true
(default value)
will include additional filters, and false
will exclude them. Please note that
we removed the sorting
, minPrice
and maxPrice
parameters from the
canonical url parameters.
See more in the related commit.
Drop support of Node 14β
In this version we've dropped support for Node 14 (EOL: 2023-04-30). The minimum required version is now Node 16.
You need to check your project dependencies for compatibility with at least Node
16 (you can check npm to find infos about your
dependencies) and upgrade them in your package.json
file.
If you are a Front-Commerce-Cloud customer, when you upgrade to Front-Commerce 2.25+, please contact us to upgrade the Node version used to deploy your project(s).
New default sorting method for ElasticSearch datasourceβ
In this version we changed the behavior when sorting with ElasticSearch datasource. From now on, if no sorting params are passed to the datasource, it will instead sort by the items' category index.
It also affects the sort by "Popular" on Front-Commerce themes.
Please let us know if you encounter any issues regarding this new behavior.
Use facet labels as valuesβ
To opt-in to using facet labels as values, you must add the following following
configuration to your config/website
:
module.exports = {
...
search: {
dynamicFacetSize: 10,
ignoredAttributeKeys: [],
attributeFacetMinimumDocumentCount: 1,
authorizedCategoriesFacet: [],
categoryFacetMinimumDocumentCount: 1,
useAttributeLabels: true,
},
};
This also introduced the new isUsingIdsForAttributes
method for datasources,
if you have custom datasources, you must implement this method.
If your datasource already uses labels as values the method should return
false
, for example:
- Algolia uses labels as values
- Elasticsearch uses ids as values
Multi shipment enhanced displayβ
Only for Magento 2
In this version we've added the list of products shipped in each shipments of an order.
If you've redefined the resolver for Shipment.trackingDetails
, you must
synchronize your version to apply
the same kind of change as in the patch providing the feature
so that items
is correctly defined in the tracking details.
If you've overridden the OrderShipmentTrackingFragment.gql
file, you must
inject a new fragment:
#import "theme/modules/User/Order/OrderShipmentTrackingProducts/OrderShipmentTrackingProductsFragment.gql"
fragment OrderShipmentTrackingFragment on Shipment {
trackingDetails {
trackingId
name
url
items {
...OrderShipmentTrackingProductsFragment
}
__typename
}
}
If you've overridden the BaseTrackingDetails
component, you must add a new
component to display the list of items:
import React from "react";
import { FormattedMessage } from "react-intl";
import Link from "theme/components/atoms/Typography/Link";
import { BodyFade } from "theme/components/atoms/Typography/Body";
import OrderShipmentTrackingProducts from "theme/modules/User/Order/OrderShipmentTrackingProducts";
const Tracking = ({ tracking }) => {
const name = tracking.url ? (
<Link to={tracking.url}>{tracking.name}</Link>
) : (
tracking.name
);
return (
<div className="account-orders-details__item">
<div className="account-orders-details__item__title">{name}</div>
<BodyFade>
<FormattedMessage
id="modules.User.Order.OrderShipmentTracking.number"
defaultMessage="Tracking number: {trackingId}"
values={{ trackingId: tracking.trackingId }}
/>
</BodyFade>
<OrderShipmentTrackingProducts items={tracking.items} />
</div>
);
};
export default Tracking;
Magic Buttonβ
To implement the Magic Button related features, we have changed several files from the theme:
theme/layouts/GenericLayout.js
(see the corresponding commit)theme/modules/ProductView/ProductItem/ProductItem.js
(see the corresponding commit)theme/modules/CmsBlock/CmsBlock.js
(see the corresponding commit)theme/pages/Product/Product.js
(see the corresponding commit)theme/pages/Account/Dashboard/Dashboard.js
(see the corresponding commit)theme/pages/Account/Dashboard/EnhanceDashboard.js
(see the corresponding commit)theme/pages/Account/Orders/Details/Invoice/Invoice.js
(see the corresponding commit)theme/pages/Account/Orders/Details/Details.js
(see the corresponding commit)theme/pages/CmsPage/CmsPage.js
(see the corresponding commit)theme/pages/Category/Category.js
(see the corresponding commit)- Mandatory
theme/components/atoms/Colors/_colors.scss
(see the corresponding commit) theme/modules/_modules.scss
(see this first commit and this second commit)theme/components/_components.scss
(see the corresponding changes)
If you have an override of template/index.html
, you need to apply the
following changes:
<script>
window.__APOLLO_STATE__ = %%__APOLLO_STATE__%%;
</script>
+ <script>
+ window.__CONTRIBUTION_MODE_DATA__ = %%__CONTRIBUTION_MODE_DATA__%%;
+ </script>
<script>
window.__MAINTENANCE__ = %%__MAINTENANCE__%%;
</script>
We strongly advice you to synchronize any override you may have done in your project.
Negotiable Quotes: online paymentsβ
In this release, we've added support for a first online payment method (Stripe) to the negotiable quote checkout.
To achieve this feature, we had to perform a minor but potentially impactful Breaking Change to the negotiable checkout. The payment method selection step now only performs a single mutation instead of two.
The setNegotiableQuotePaymentMethod
and placeNegotiableQuoteOrder
mutations
have been merged into setNegotiableQuotePaymentInformationAndPlaceOrder
. Here
is
the merge request containing the diff,
so that you can check whether or not your overrides are affected by this change.
To use this feature you need to:
- update your Magento2 B2B Front-Commerce module to version 1.2.0+
- ensure you haven't overriden theme files impacted with this breaking change
Impacted files:
theme/modules/Checkout/NegotiableQuotes/Payment/ChoosePayment.js
theme/modules/Checkout/NegotiableQuotes/Payment/EnhanceChoosePayment.js
theme/modules/Checkout/NegotiableQuotes/Payment/SetNegotiableQuotePaymentMethod.gql
theme/modules/Checkout/NegotiableQuotes/PlaceOrder/EnhancePlaceOrder.js
theme/modules/Checkout/NegotiableQuotes/PlaceOrder/PlaceNegotiableQuoteOrderMutation.gql
theme/modules/Checkout/NegotiableQuotes/PlaceOrder/PlaceOrder.js
theme/modules/Checkout/NegotiableQuotes/PlaceOrder/SetNegotiableQuotePaymentInformationAndPlaceOrderMutation.gql
We usually try hard to avoid Breaking Changes. In this context, we decided to remain pragmatic as we knew that this relatively new feature wasn't used by many projects. For this reason, we chose the simplest solution instead of adding complexity with deprecated GraphQL mutations and conditional paths in the checkout. Please contact us if you need help with this upgrade.
Image cachingβ
In this version we've introduced
Focal Point
support for the <Image>
component.
If you use Front-Commerce's media middleware, the cache needs to be fully regenerated.
To do so, you should delete the .front-commerce/cache/images
directory and
deploy your project.
Regenerate image cache will lead to a high CPU usage, to not disturb the availability of your app, we recommend you do this outside peak visit time on your website.
Performance: remove chunks preloadingβ
We've
removed the chunks preloading feature
as it led to blocking network requests that could reduce the LCP / FCP
of your app. From our analysis it improves the performance of the application and is a good default.
We invite you to test the impact of this change (i.e: run a Core Web Vitals test on your application and compare the results to confirm this).
If you want to restore the previous behavior, you can set the
FRONT_COMMERCE_ENABLE_CHUNKS_PRELOAD=true
environment variable.