Skip to content

Commit

Permalink
Cleans up inventory quantity JS
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-scheele committed Jul 29, 2024
1 parent 3a302a9 commit a4ef71f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions assets/product-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,17 @@ if (!customElements.get('product-info')) {
const inventoryStatusEl = html.querySelector('.product__inventory');

if (inventoryStatusEl !== null) {
let mishaAndPuff = inventoryStatusEl.querySelector('[data-misha-and-puff]')?.innerHTML;
const innerEl = inventoryStatusEl.querySelector('.inner');
const outerEl = inventoryStatusEl.querySelector('.outer');

let mishaAndPuff = inventoryStatusEl.querySelector('[data-misha-and-puff]')?.innerHTML;
mishaAndPuff = JSON.parse(atob(mishaAndPuff));

const quantity = mishaAndPuff[variant.id];
const threshold = mishaAndPuff['threshold'];
const inStockMsg = mishaAndPuff['in-stock'];
const lowStockMsg = mishaAndPuff['low-stock'];
const noStockMsg = mishaAndPuff['no-stock'];
console.log('threshold', threshold);
console.log('quantity', quantity);
console.log(inStockMsg);
console.log(lowStockMsg);
console.log(noStockMsg);

if (quantity === 0) {
outerEl.style.fill = 'rgb(200,200,200, 0.3)';
innerEl.style.fill = 'rgb(200,200,200)';
Expand Down

0 comments on commit a4ef71f

Please sign in to comment.