Skip to content

Commit 7b153cd

Browse files
committed
Update toolkit for Paper v7.3
1 parent 13bc41d commit 7b153cd

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

src/css/base/typography.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
@apply animation-500 underline-offset-1 underline;
8686

8787
&:hover {
88-
@apply underline opacity-50;
88+
@apply underline md:opacity-50;
8989
}
9090

9191
&:focus-visible {

src/ts/products/products.ts

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const products = {
2-
2+
33
// Update page when variant selection changes
44
handleProductFormChange (
55
enableUrlParameters: boolean,
@@ -37,6 +37,40 @@ export const products = {
3737

3838
},
3939

40+
// If using combined listing this loads and sets title, description and images switching between products
41+
async handleCombinedListing (
42+
productURL: string,
43+
sectionId: string
44+
) {
45+
46+
// load product section with Section Render API
47+
try {
48+
const response = await fetch(
49+
`${productURL}?section_id=${sectionId}`
50+
);
51+
52+
// If response is not OK, throw an error
53+
if (!response.ok) {
54+
throw new Error(`HTTP error! status: ${response.status}`);
55+
}
56+
// Catpure data from fetch
57+
const responseHtml = await response.text();
58+
const html = new DOMParser().parseFromString(responseHtml, 'text/html');
59+
60+
// inject new html
61+
const oldSection = document.querySelector('.js-product')
62+
if(oldSection) {
63+
const newSection = html.querySelector('.js-product');
64+
oldSection.parentNode!.insertBefore(newSection!, oldSection);
65+
oldSection.remove();
66+
}
67+
}
68+
69+
catch (error) {
70+
console.error(error);
71+
}
72+
},
73+
4074
// Find options that are not available based on selected options
4175
setUnavailableOptions() {
4276

@@ -291,9 +325,6 @@ export const products = {
291325
(optionsSize === 1 && this.option1) ||
292326
(optionsSize === 2 && this.option1 && this.option2) ||
293327
(optionsSize === 3 && this.option1 && this.option2 && this.option3);
294-
if(optionsSize === 1) {
295-
this.all_options_selected = true;
296-
}
297328
},
298329

299330
// Update order of product gallery images

0 commit comments

Comments
 (0)