Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Refactor : getProducts api method (#177)
Browse files Browse the repository at this point in the history
* feat: multi currency

* feat: multi-currency feature

* feat: added multicurrency feature (static)

* feat: pdp: multi currency

* feat: muti-currency refactor

* chore: version upgrade

* feat: added feature to update userfields

* fix: fixed selected variantby options

* fix: cartgetters item price

* refactor: getproducts api method
  • Loading branch information
aureate-labs-team authored Jan 28, 2022
1 parent c12c7b1 commit c3f7b59
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/api-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/shopify-api",
"version": "1.0.15",
"version": "1.0.16",
"sideEffects": false,
"main": "lib/index.cjs.js",
"module": "lib/index.es.js",
Expand All @@ -15,7 +15,7 @@
"dependencies": {
"@nuxtjs/composition-api": "^0.30.0",
"@vue-storefront/core": "~2.5.0",
"@vue-storefront/shopify-apollo": "^1.0.15",
"@vue-storefront/shopify-apollo": "^1.0.16",
"graphql": "^14.5.8",
"shopify-buy": "~2.14.0"
},
Expand Down
1 change: 1 addition & 0 deletions packages/api-client/src/api/getProduct/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ export default async function getProduct(
variants(first:250){
edges{
node{
sku
availableForSale
priceV2{
currencyCode
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/shopify-apollo",
"version": "1.0.15",
"version": "1.0.16",
"description": "Vue Storefront Shopify Apollo Client",
"keywords": [
"apollo",
Expand Down
6 changes: 3 additions & 3 deletions packages/composables/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/shopify",
"version": "1.0.15",
"version": "1.0.16",
"sideEffects": false,
"main": "lib/index.cjs.js",
"module": "lib/index.es.js",
Expand All @@ -14,8 +14,8 @@
"dependencies": {
"@types/js-cookie": "^2.2.6",
"@vue-storefront/core": "~2.5.0",
"@vue-storefront/shopify-api": "^1.0.15",
"@vue-storefront/shopify-apollo": "^1.0.15"
"@vue-storefront/shopify-api": "^1.0.16",
"@vue-storefront/shopify-apollo": "^1.0.16"
},
"peerDependencies": {
"@nuxtjs/composition-api": "0.29.3"
Expand Down
10 changes: 5 additions & 5 deletions packages/composables/src/getters/cartGetters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const getCartItemImage = (product: any): string => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const getCartItemPrice = (product: any): AgnosticPrice => {
return {
regular: product?.variant.compareAtPriceV2.amount|| null,
special: product?.variant.priceV2.amount|| null
regular: product && product?.variant.compareAtPriceV2 != null ? product?.variant.compareAtPriceV2?.amount : null || null,
special: product && product?.variant.priceV2 != null ? product?.variant.priceV2.amount : 0 || null
};
};

Expand All @@ -56,9 +56,9 @@ export const getCartItemSku = (product: any): string => product?.variant.sku ||
export const getCartTotals = (cart): AgnosticTotals => {
if (cart && cart !== null) {
return {
total: parseFloat(cart.totalPriceV2.amount),
subtotal: parseFloat(cart.subtotalPriceV2.amount),
special: parseFloat(cart.subtotalPriceV2.amount),
total: parseFloat(cart.totalPriceV2?.amount),
subtotal: parseFloat(cart.subtotalPriceV2?.amount),
special: parseFloat(cart.subtotalPriceV2?.amount),
};
}
};
Expand Down
1 change: 0 additions & 1 deletion packages/composables/src/useCart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const params: UseCartFactoryParams<Cart, CartItem, Product> = {
load: async (context: Context, { customQuery }) => {
// check if cart is already initiated
const appKey = context.$shopify.config.app.$config.appKey;
console.log('customQuery:', customQuery);
let existngCartId = context.$shopify.config.app.$cookies.get(appKey + '_cart_id');
if (existngCartId === undefined || existngCartId === '') {
existngCartId = await context.$shopify.api.createCart().then((checkout) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/theme/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vue-storefront/shopify-theme",
"version": "1.0.15",
"version": "1.0.16",
"scripts": {
"dev": "nuxt",
"build": "nuxt build -m",
Expand All @@ -19,7 +19,7 @@
"@vue-storefront/middleware": "~2.5.0",
"@vue-storefront/nuxt": "~2.5.0",
"@vue-storefront/nuxt-theme": "~2.5.0",
"@vue-storefront/shopify": "^1.0.15",
"@vue-storefront/shopify": "^1.0.16",
"cookie-universal-nuxt": "^2.1.3",
"core-js": "^3.19.1",
"isomorphic-fetch": "^2.2.1",
Expand Down

0 comments on commit c3f7b59

Please sign in to comment.