Find Jobs
Hire Freelancers

Svelte error : 'product' is not a store with a subscribe method with shopify api

$15-25 USD / hour

Mbyllur
Postuar over 2 years ago

$15-25 USD / hour

<script> import { getProduct } from '../lib/store'; const productId = 'a'; const product = getProduct(productId); $: [login to view URL]($product); let quantity = 0; let price = 0; let total = 0; $: quantity = quantity < 1 ? 1 : quantity; $: options = $[login to view URL]((items) => { let list = {}; [login to view URL] = [login to view URL]; [login to view URL] = [login to view URL][0].value; [login to view URL] = [login to view URL][1].value; [login to view URL] = [login to view URL]; return list; }); $: [login to view URL](options); let selected_color; let selected_size; let selected; $: selected = [login to view URL](function (elem) { return [login to view URL] === selected_size && [login to view URL] === selected_color; }); $: if (selected_color && selected_size) { total = (quantity * selected[0].price).toFixed(2); } $: if (selected_color && selected_size) { [login to view URL]('selected variant ID : ' + selected[0].id); //alert('selected variant ID : '+ selected[0].id) } </script> {#await product} <h1> {$[login to view URL]} </h1> <img src={$[login to view URL][0].[login to view URL]} alt="product" style="width:350px;border-radius:15%;" /> <br /><br /> <h3>Color</h3> {#each $[login to view URL][0].values as option} <label> <input bind:group={selected_color} selected="fa" type="radio" name={option} value={option} /> {option} </label> {/each} <h3>Size</h3> {#each $[login to view URL][1].values as option} <label> <input bind:group={selected_size} selected="fa" type="radio" name={option} value={option} /> {option} </label> {/each} {#if selected_color}{selected_color} / {/if} {#if selected_size}{selected_size}{/if} <br /><br /> <label for="quantity">Quantity</label> <input name="quantity" bind:value={quantity} style="width:150px;" type="number" /> <p> price : $ {total} </p> {#if selected_color && selected_size} <p> Selected variant ID {selected[0].id} </p> {/if} {/await} This is my API function [login to view URL] export async function getProduct(handle) { const query = ` { productByHandle(handle: "${handle}") { collections(first: 1) { edges { node { products(first: 5) { edges { node { priceRange { minVariantPrice { amount } } handle title description id images(first: 5) { edges { node { originalSrc altText } } } } } } } } } id title handle description images(first: 5) { edges { node { originalSrc altText } } } options { name values id } variants(first: 25) { edges { node { selectedOptions { name value } } } } } }`; const response = await ShopifyData(query); const product = [login to view URL] ? [login to view URL] : []; return product; }
ID e Projektit: 32620458

Rreth projektit

2 propozime
Projekt në distancë
Aktive 2 yrs ago

Po kërkoni të fitoni para?

Përfitimet e ofertës për Freelancer

Vendosni buxhetin dhe afatin tuaj
Paguhuni për punën tuaj
Përshkruani propozimin tuaj
Është falas të regjistrohesh dhe të bësh oferta për punë
2 profesionistët e pavarur ofrojnë mesatarisht $15 USD/orë oferta për këtë punë
Avatari i Përdoruesit
Hi I have gone through the job description. I am a senior web and app developer having more than 5 years of experience in the field of development. I can develop and design the project for you as per your requirements with the full functionality. My expertise is Node JS, React JS, Angular JS, Vue JS, Codeigniter, WordPress, PHP, Magento, Shopify, Bootstrap, Woo-commerce, Ecommerce, API Integration, Backup & Restore at different domain, Shell scripting, React Native, Flutter, Android, iOS, web scraping, AWS and a lot more. I need to discuss your project in detail with you so that I can assist you much better. I will be available more than 40 hours per week and able to start your project as soon as possible according to you. Thank you for your consideration
$15 USD në 40 ditë
5,0 (1 review)
1,8
1,8
Avatari i Përdoruesit
Hello, you need to import writeable from svelte/store and assign that to product. I will be happy to help you in anything else too. Regards, Bassam
$15 USD në 40 ditë
0,0 (0 përshtypje)
0,0
0,0

Rreth klientit

Flamuri i THAILAND
Phuket, Thailand
0,0
0
Anëtar që nga jan 10, 2022

Verifikimi i klientit

Faleminderit! Ne ju kemi dërguar me email një lidhje për të kërkuar kredinë tuaj falas.
Ndodhi një gabim gjatë dërgimit të email-it tuaj. Ju lutemi provoni përsëri.
Përdorues të regjistruar Punë të postuara
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Po ngarkohet shikimi paraprak
Leja u dha për Geolocation.
Seanca e hyrjes ka skaduar dhe ke dalë. Hyr sërish.