Open margamorais opened 3 weeks ago
Hi,
I'm not able to recreate this. Can you check a couple of things:
44
, 47
etc?ActiveOrderStrategy
defined?When you execute the addItemToOrder
mutation, the active order is determined here. This uses the ActiveOrderStrategy to determine which order to operate on. In the default implementation this is looking at the active session to determine the order id.
So to debug this I'd look in the session
table in the database and see what the activeOrderId
value is listed as for the active session.
Hi Michael,
I checked the session table in the db, and the activeOrderId corresponding to the session I'm currently on has the same id that is returned when I query activeOrder, and it's definitely different from the ID that shows up in the error when I use the mutation addPaymentToOrder.
We detected it's a problem coming from one of our configurations, we are debugging to find out the issue. Thank you for your help, I'm going to close the issue now.
Hi @michaelbromley,
After debugging all of our plugins, we found out the issue is happening in the multivendor plugin. We are using the multivendor plugin that vendure provides, however we had to make some changes in the plugin to adapt it to our use case. One of the those things is, we need products to be assigned to multiple channels, not just the default channel and the seller channel, as it is assumed in the multivendor original plugin.
The first thing we did was altering the mv-order-seller-strategy.ts, setOrderLineSellerChannel method, where we need to find the seller channel amongst the multiple channels that the product might have. We replaced this:
if (orderLine.productVariant.channels.length === 2) {
const sellerChannel = orderLine.productVariant.channels.find(
(c) => !idsAreEqual(c.id, defaultChannel.id)
);
if (sellerChannel) {
return sellerChannel;
}
}
with this:
if (orderLine.productVariant.channels.length > 1) {
const sellerChannel = orderLine.productVariant.channels.find(
(c) =>
!c?.customFields?.isCompanyChannel &&
!idsAreEqual(c.id, defaultChannel.id)
);
if (sellerChannel) {
return sellerChannel;
}
}
And then the issue with the payment started happening.
Do you know if there is any other part of the multivendor plugin where we would have to make changes to make this use case possible?
Thank you for your help!
Describe the bug I have multiple channels created in my backoffice. When I try to complete an order in a channel different from the default channel, the order fails when calling the addPaymentToOrder mutation. The following is a screenshot of the error:
The error states that an order with this ID is not found, however, this is not the ID of my current active order:
The current active order has the id 28, and the error mentions id 44, and every time I call the mutation, I get the same error but with an incremented ID in the error (i.e. 44, then 47, then 48).
If I try to add the payment in the default channel, its successful and I can finish the payment flow.
To Reproduce Steps to reproduce the behavior:
Expected behavior I should be able to complete an order in a channel different than the default channel.
Environment (please complete the following information):