[feature] custom strings for restock detector
Opened this issue · 0 comments
Version and OS
0.47.06 on linux/docker
Is your feature request related to a problem? Please describe.
The problem I am facing is that the list of out-of-stock strings in stock-not-in-stock.js does not cover this product: https://www.vagabond.com/es/sheila-5635-001-35
¡Pronto estarán en stock!
Describe the solution you'd like
I have thought about just opening a PR with my new use case, but maybe what would be better for the long run would be to allow a custom string to be passed to the "Restock & Price Detection" tab when you configure the URL?
Describe the use-case and give concrete real-world examples
The use case is using the restock detector feature to parse the fact that size 39 is out of stock for this URL at this moment:
https://www.vagabond.com/es/sheila-5635-001-35
<button class="jsProductPageSizeButton semButtonSecondary tw-p-0 tw-pt-2 tw-flex tw-flex-wrap tw-justify-center tw-items-center tw-border tw-border-neutral300 on-active:tw-bg-neutral100 on-active:tw-shadow-[0_2px_0_0_theme(colors.black)] on-active:tw-font-semibold on-active:tw-text-stroke-width-0 tw-bg-[linear-gradient(to_bottom_right,transparent,transparent_calc(50%-1px),theme(colors.neutral300)_calc(50%-0.5px),theme(colors.neutral300)_calc(50%+0.5px),transparent_calc(50%+1px),transparent)] jsSizeSelectorStockUpdates jsProductPageSizeButtonNotBuyable tw-relative tw-text-stroke-width-0 active" data-buyable="false" data-size="39" data-eusize="39" data-code="5635-001-35-39" data-fewinstock="False" data-stock-message="Pronto en stock" data-delivery-information="" data-subscription-text="<p class="tinymce-content"><span class="text-bold">&iexcl;Pronto estar&aacute;n en stock!<br /></span><span class="tinymce-content" style="font-size: 13px;">Elige la talla e introduce tu correo electr&oacute;nico para recibir una notificaci&oacute;n <span class="tinymce-content">en cuanto tu talla</span> est&eacute; disponible.</span></p>">
39
<div class="tw-bg-white tw-border tw-absolute tw-w-max tw-z-40 tw-px-4 tw-pt-2 tw-bottom-[50px] tw-text-details-sm-regular tw-max-w-[20em] tw-hidden [*:hover>&]:[@media(hover:hover)_and_(pointer:fine)]:tw-block]">
Pronto en stock
</div>
</button>
I could write a CSS selector with the data-buyable
attribute filtering by the data-eusize=39
attribute, but this request is about having the restock feature allow me to copy&paste "Pronto estarán en stock" to see that it is not in stock.
I have seen that the page has an ld+json script:
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "SHEILA",
"image": [
"https://cdn.vagabond.com/thumbnails/200/211/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/488/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/596/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/976/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/1336/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/2164/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/211/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/488/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/596/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/976/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/1336/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/2164/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/211/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/488/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/596/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/976/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/1336/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/2164/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/78/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/180/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/220/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/361/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/494/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/800/crop/productimages/pos1/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/78/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/180/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/220/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/361/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/494/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/800/crop/productimages/pos2/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/200/78/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/462/180/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/564/220/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/924/361/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/1264/494/crop/productimages/pos3/list/5635-001-35.jpg","https://cdn.vagabond.com/thumbnails/2048/800/crop/productimages/pos3/list/5635-001-35.jpg"],
"description": "Sheila son botas de montar minimalistas con un estilo atemporal. El modelo está confeccionado en cuero marrón oscuro con puntera redondeada, caña ancha y cierre de cremallera lateral. Tacón en bloque mide 38 mm. Cuero marrón oscuro Puntera redondeada Caña ancha Cierre con cremallera Tacones de 38mm Para un cuidado duradero: usa crema para zapatos e impermeabilizante para alargar la vida útil del calzado.",
"sku": "5635-001-35",
"brand": {
"@type": "Thing",
"name": "Vagabond Shoemakers"
},
"offers": {
"@type": "Offer",
"url": "https://www.vagabond.com/es/sheila-5635-001-35/",
"priceCurrency": "EUR",
"price": "220.00",
"itemCondition": "https://schema.org/NewCondition",
"availability": "https://schema.org/InStock",
"seller": {
"@type": "Organization",
"name": "Vagabond International AB"
}
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": 5,
"ratingCount": 3
}
}
</script>
Unfortunately the item appears as in stock ("availability": "https://schema.org/InStock") because 1 of its variants is, that is there is stock in 2 out of the 7 sizes available. I don't know if this is supposed to be like this in JSON-LD, but it does not make much sense to me since a buyer will usually only buy one variant of the product, so knowing which one is in stock is relevant.
Additional context
I am happy to give a go to any changes to the Python side; I am much less comfortable on the JS side of things.