From 3151a432e0bb37f13c9e2fad52a3b5bd692c506f Mon Sep 17 00:00:00 2001 From: "Mark J. Becker" Date: Thu, 18 Jul 2024 11:45:47 +0200 Subject: [PATCH] Remove case changes from product SKUs --- blocks/product-details-custom/product-details-custom.js | 6 +++--- blocks/product-details/product-details.js | 8 ++------ blocks/product-list-page-custom/ProductList.js | 4 ++-- .../product-list-page-custom/product-list-page-custom.js | 2 +- .../product-recommendations/product-recommendations.js | 2 +- scripts/commerce.js | 2 -- scripts/minicart/Minicart.js | 4 ++-- tools/pdp-metadata/pdp-metadata.js | 9 +-------- 8 files changed, 12 insertions(+), 25 deletions(-) diff --git a/blocks/product-details-custom/product-details-custom.js b/blocks/product-details-custom/product-details-custom.js index e9ae25826e..749072b3f5 100644 --- a/blocks/product-details-custom/product-details-custom.js +++ b/blocks/product-details-custom/product-details-custom.js @@ -23,7 +23,7 @@ async function getVariantDetails(variantIds, sku) { const result = await performCatalogServiceQuery( refineProductQuery, { - sku: sku.toUpperCase(), + sku, variantIds, }, ); @@ -57,9 +57,9 @@ async function setJsonLdProduct(product) { '@type': 'Brand', name: brand?.value, }, - url: new URL(`/products/${urlKey}/${sku.toLowerCase()}`, window.location), + url: new URL(`/products/${urlKey}/${sku}`, window.location), sku, - '@id': new URL(`/products/${urlKey}/${sku.toLowerCase()}`, window.location), + '@id': new URL(`/products/${urlKey}/${sku}`, window.location), }, 'product'); } diff --git a/blocks/product-details/product-details.js b/blocks/product-details/product-details.js index 1ba5d5d409..d7391824e3 100644 --- a/blocks/product-details/product-details.js +++ b/blocks/product-details/product-details.js @@ -48,9 +48,9 @@ async function setJsonLdProduct(product) { '@type': 'Brand', name: brand?.value, }, - url: new URL(`/products/${urlKey}/${sku.toLowerCase()}`, window.location), + url: new URL(`/products/${urlKey}/${sku}`, window.location), sku, - '@id': new URL(`/products/${urlKey}/${sku.toLowerCase()}`, window.location), + '@id': new URL(`/products/${urlKey}/${sku}`, window.location), }, 'product'); } @@ -99,10 +99,6 @@ function setMetaTags(product) { createMetaTag('og:image:secure_url', metaImage, 'property'); createMetaTag('og:product:price:amount', price.value, 'property'); createMetaTag('og:product:price:currency', price.currency, 'property'); - - createMetaTag('twitter:card', product.shortDescription, 'name'); - createMetaTag('twitter:title', product.metaTitle, 'name'); - createMetaTag('twitter:image', metaImage, 'name'); } export default async function decorate(block) { diff --git a/blocks/product-list-page-custom/ProductList.js b/blocks/product-list-page-custom/ProductList.js index 5fa1c33ab8..2b4b812cac 100644 --- a/blocks/product-list-page-custom/ProductList.js +++ b/blocks/product-list-page-custom/ProductList.js @@ -79,12 +79,12 @@ class ProductCard extends Component { return html`
  • ${renderPrice(product, this.formatter.format, html, Fragment)}
  • `; diff --git a/blocks/product-list-page-custom/product-list-page-custom.js b/blocks/product-list-page-custom/product-list-page-custom.js index d162c1ff3e..7eb82161aa 100644 --- a/blocks/product-list-page-custom/product-list-page-custom.js +++ b/blocks/product-list-page-custom/product-list-page-custom.js @@ -411,7 +411,7 @@ class ProductListPage extends Component { products: this.state.products.items.map((p, index) => ({ name: p.name, sku: p.sku, - url: new URL(`/products/${p.urlKey}/${p.sku.toLowerCase()}`, window.location).toString(), + url: new URL(`/products/${p.urlKey}/${p.sku}`, window.location).toString(), imageUrl: p.images?.length ? p.images[0].url : '', price: p.price?.final?.amount?.value ?? p.priceRange?.minimum?.final?.amount?.value, rank: index, diff --git a/blocks/product-recommendations/product-recommendations.js b/blocks/product-recommendations/product-recommendations.js index 459e56a6a1..07f1303d5f 100644 --- a/blocks/product-recommendations/product-recommendations.js +++ b/blocks/product-recommendations/product-recommendations.js @@ -71,7 +71,7 @@ function renderItem(unitId, product) { }; const item = document.createRange().createContextualFragment(`
    - + ${product.name} diff --git a/scripts/commerce.js b/scripts/commerce.js index e795057ffb..fbb0637f8a 100644 --- a/scripts/commerce.js +++ b/scripts/commerce.js @@ -230,8 +230,6 @@ export function getSkuFromUrl() { const productsCache = {}; export async function getProduct(sku) { - // eslint-disable-next-line no-param-reassign - sku = sku.toUpperCase(); if (productsCache[sku]) { return productsCache[sku]; } diff --git a/scripts/minicart/Minicart.js b/scripts/minicart/Minicart.js index 61359998f2..0418642f75 100644 --- a/scripts/minicart/Minicart.js +++ b/scripts/minicart/Minicart.js @@ -92,10 +92,10 @@ class ProductCard extends Component { return html`