Closed derrickrc closed 2 years ago
Adding on to this, I have some code that works fine on iOS but does not work on Android and seems to be the same issue:
checkOut() {
const app = this.context;
const pos = Pos.create(app);
const cart = Cart.create(app);
const orders = this.props.focusedCustomerOrders;
cart.dispatch(Cart.Action.CLEAR);
orders.forEach(order => {
const data = {
variantId: this.extractVariantId(order.variantId),
title: order.title
};
cart.dispatch(Cart.Action.ADD_LINE_ITEM, {
data
});
})
pos.dispatch(Pos.ActionType.CLOSE);
}
I also got the same issue on Android. Quick sale payload is working but existing variant Id is not.
// Not working
async testaddtocart() {
const variantId = '39440334913667';
var unsubscriber = this.cartApp.subscribe(Cart.Action.UPDATE, (payload) => {
// closeApp(this.app);
unsubscriber();
this.loadingAddProduct = false;
});
const lineItemPayload = {
variantId: parseInt(variantId),
quantity: 1,
};
this.cartApp.dispatch(Cart.Action.ADD_LINE_ITEM, {
data: lineItemPayload,
});
}
// Working
async testaddtocart2() {
var unsubscriber = this.cartApp.subscribe(Cart.Action.UPDATE, (payload) => {
// closeApp(this.app);
unsubscriber();
this.loadingAddProduct = false;
});
const lineItemPayload = {
price: 20,
quantity: 1,
title: 'Bab Low - Blue Jay // White Soles',
taxable: true,
};
this.cartApp.dispatch(Cart.Action.ADD_LINE_ITEM, {
data: lineItemPayload,
});
}
@derrickrc Is this still happening with POS Android? Can you post any errors you receive when running your code?
I don't recall there being any errors, it just doesn't work.
On Tue, Aug 24, 2021, 1:13 PM Andrew Apperley @.***> wrote:
@derrickrc https://github.com/derrickrc Is this still happening with POS Android? Can you post any errors you receive when running your code?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Shopify/shopify-app-bridge/issues/58#issuecomment-904865881, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALEPL7YDJSW7RLFNTM6JQPLT6POLJANCNFSM46X7RAXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
Getting this issue in front of the Retail team. Will post back with any information I gather.
This appears to be fixed, thank you @js-goupil!
@andrewapperley
For me it's still the same for POS app (IOS). The error says: 1 product couldn't be found and was removed.
variantId is valid, it also does work with custom items...
using @shopify/app-bridge-utils@^3.1.1
@derrickrc hello, have you solved it with upgrade? I upgraded to 3.1.1 but it seems to be the same...
Check your sales channel for that variantId. POS is likely not checked.
On Thu, Jul 7, 2022, 5:23 AM Kiril Dokh @.***> wrote:
@derrickrc https://github.com/derrickrc hello, have you solved it with upgrade? I upgraded to 3.1.1 but it seems to be the same...
— Reply to this email directly, view it on GitHub https://github.com/Shopify/shopify-app-bridge/issues/58#issuecomment-1177450346, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALEPL7YDQ3HYH3QNTAATOHLVS24ZJANCNFSM46X7RAXA . You are receiving this because you were mentioned.Message ID: @.***>
@derrickrc I double checked, it's checked for both:
Online Store and Point of Sale
Okay, solved this, needed to convert variantId
to int (with parseInt
), silly mistake but I would leave it here just in case
I am testing some things on the new Android POS and for some reason I can't get this to work: https://shopify.dev/tools/app-bridge/actions/cart#add-line-item.
It works when adding a Quick Sale line item, but when I pass the
variantId
it simply doesn't work. I have tried bothint
andstring
data types for the variantId and no joy. The same code works on new Shopify POS for iOS. Is this broken or am I missing something?