Hello everybody,
I follow, i think correctly, the Shopify integration document, step by step.
The button is just completed the whole process of adding the upload button is working (and in french) on my shopify store, on a product page.
When we upload a file, there is no preview. The file link is there and we can delete it if needed.
I use debut theme for the trial before to do it on Turbo.
Here the code of uploadcare-settings.liquid :
<script charset="utf-8" src="https://ucarecdn.com/libs/widget/3.x/uploadcare.full.min.js">
</script>
<script>
UPLOADCARE_PUBLIC_KEY = '71777bd13309f31cb455';
// UPLOADCARE_EFFECTS = 'crop,rotate,mirror,flip';
UPLOADCARE_LOCALE ='fr';
UPLOADCARE_PREVIEW_STEP = true;
UPLOADCARE_CLEARABLE = true;
var widget = uploadcare.Widget('[role=uploadcare-uploader]');
var productImage = document.querySelector('.product-featured-img');
var frameSelector = document.getElementById('frame');
var uploadedImage = null;
var currentFrame = frameSelector.options[frameSelector.selectedIndex].dataset.frameId;
widget.onUploadComplete(function (fileInfo) {
uploadedImage = fileInfo.cdnUrl;
productImage.src = uploadedImage + '-/resize/932x932/-/stretch/fill/-/resize/1106x1106/-/overlay/' + currentFrame + '/';
// clears the default srcset of the product image
productImage.dataset.srcset = productImage.srcset = '';
});
frameSelector.addEventListener('change', function (e) {
currentFrame = e.target.options[e.target.selectedIndex].dataset.frameId;
if (uploadedImage !== null) {
productImage.src = uploadedImage + '-/resize/932x932/-/stretch/fill/-/resize/1106x1106/-/overlay/' + currentFrame + '/';
}
});
</script>
In the product-template.liquid
{% include 'uploadcare-fields' %}
<div class="selector-wrapper product-form__item">
<label for="frame">Frame</label>
<select required class="required product-form__input" id="frame" name="properties[Frame]" >
<option data-frame-id="31fd867c-8bfe-4b83-840d-6573efeebbe0" value="Frame 1">Frame 1</option>
<option data-frame-id="2064a171-7e8c-4140-82a7-de9f33e3806b" value="Frame 2">Frame 2</option>
</select>
</div>
Thank you for your help.
Have a good day.
Fab