Nespresso 咖啡粉囊 | Nespresso 香港
// Example SKU data
const skuData = {
category: 'coffee', // PDP type --> coffee machine accessory
tagType: 'discount', // message type --> discount, noti
promoMsgKR: '♦ 10 Sleeve Coffee assortment', // promotion message --> local language
promoMsgEN: '♦ 10 Sleeve Coffee assortment\n♦ ♦ 10 Sleeve Coffee assortment', // promotion message --> English
sku: ['150305'], // 11.11 EM Bundle
startDate: '10/16/2023',
endDate: '01/08/2099',
discount: '-1'
};
// Select the current class
const priceLabelWrapper = document.querySelector('._priceLabelWrapper_10cre_6');
// Check if the element exists
if (priceLabelWrapper) {
// Add a font style to the current class
priceLabelWrapper.style.fontFamily = 'Arial, sans-serif'; // Change to your desired font
priceLabelWrapper.style.fontSize = '16px'; // Change to your desired font size
priceLabelWrapper.style.color = '#333'; // Change to your desired font color
// Create a new class under the current class
const newClassStyle = document.createElement('style');
newClassStyle.type = 'text/css';
newClassStyle.innerHTML = `
.newClass {
font-weight: bold;
text-decoration: underline;
margin-top: 10px;
color: #007BFF; // Optional: Change to your desired color
}
`;
document.head.appendChild(newClassStyle);
// Create a new element with the new class
const newElement = document.createElement('div');
newElement.className = 'newClass';
// Populate the new element with the promotional message based on the SKU data
newElement.innerText = skuData.promoMsgEN; // Change to skuData.promoMsgKR for local language
// Append the new element under the current class
priceLabelWrapper.appendChild(newElement);
}