Developer forum

Forum » Ecommerce - Standard features » Stock location base on shipping country

Stock location base on shipping country

Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

I have custom requirements to manage stock base on shipping location.

They have 2 stock locations Singapore and Hongkong,

if the shipping address is Singapore, item stock should come from the Singapore location (in list page no stock item should hide) 

if the shipping address is Hongkong or china, item stock should come from the Hongkong location (in list page no stock item should hide)

note:- guest user is treated base on IP location before they select a shipping address, they have only one shop in the eCommerce also they use stock base on varience  

 

any idea how can I achieve this with the best solution 


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Shiwanka

You can set the current stock location context by adding ?Stocklocation={locationid} to the url. Then DW will remember what location the current visitor is using.

So when you detect the user country, redirect or by javascript fetch, set the stock location.

BR Nicolai

Votes for this answer: 1
 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

Hey Thanks, Nicolai

I will try and update you

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

HI Nicolai

Your suggestion works fine with stock retrieval

But I have an issue on these 2 options

 

 

 

when I tick the options, still all products are showing and all varients get hidden

you can check here  https://bit.ly/2TN1Rhj  and click Dress and item ColoutBlock Dress

variance should appear like this for items that have stock

 

this item 2Y only had stock, but when I enable the settings for only valid stock this loop becomes variantgroup.GetLoop("VariantAvailableOptions") Empty

 

anything missing on my end

 

 

 

 
Nicolai Pedersen
Reply

Hi Shiwanka

Yes - those settings are reflecting what is on the product.stock property and does not take all units and location into consideration. 

When you use the index, the index has to be used to find the correct products.

It is not super easy - a solution can be to add some logic that will update the stock field on the product using SQL and let the index remove all products that is not in stock somewhere...

Sorry about the inconvenience.

BR Nicolai

 

You must be logged in to post in the forum