Problem getting store shipping options for active cart

There seems to be an issue with popstore.CartServices.get#ShippingOptions service. I am calling it with an active cart that has productStoreId set. That service calls mantle.product.StoreServices.get#StoreShippingOptions and passes to it productStoreId which is always null even with the scenario I mentioned (this is happening because popstore.CartServices.get#ActiveOrderAndCustomer which is called to get active cart info is not returning the productStoreId).

So when calling mantle.product.StoreServices.get#StoreShippingOptions I think productStoreId should be passed from orderHeader.productStoreId, otherwise I always get a list of all ShipmentMethod type Enumeration.

This is the service and exact line I am talking about (with a comment)…

<service verb="get" noun="ShippingOptions">
        <parameter name="shippingOptions"/>
        <service-call name="popstore.CartServices.get#ActiveOrderAndCustomer" out-map="context"/>
        <if condition="!cartOrderId"><return message="Cart is empty" public="true" type="warning"/></if>

        <entity-find-one entity-name="mantle.order.OrderHeader" value-field="orderHeader">
        <field-map field-name="orderId" from="cartOrderId"/></entity-find-one>
        <entity-find-one entity-name="mantle.order.OrderPart" value-field="orderPart">
            <field-map field-name="orderId" from="cartOrderId"/></entity-find-one>

        <service-call name="" out-map="shippingContactListInfo"
            in-map="[partyId:customerPartyId, postalContactMechPurposeId:'PostalShippingDest',
        <!-- productStoreId below should be passed from orderHeader.productStoreId, otherwise it is always passed as null now even when an active cart with a productStoreId set exists -->
        <service-call name="mantle.product.StoreServices.get#StoreShippingOptions" in-map="[productStoreId:productStoreId, orderId:cartOrderId, orderPartSeqId:orderPart.orderPartSeqId,postalContactMechId:shippingContactListInfo.postalAddressList?.first?.postalContactMechId, getRates:true]" out-map="context"/>

Feel free to submit a PR to fix the problem. This is a great upstream fix

I have made a PR for the above issue Pass productStoreId down to get#StoreShippingOptions from active cart's order header by orabitarek · Pull Request #70 · moqui/PopRestStore · GitHub

1 Like