cancel
Showing results for 
Search instead for 
Did you mean: 

Add stock/out of stock for google product feed

Add stock/out of stock for google product feed

hi all

 

using amasty product feed for goolge shopping

 

all working fine apart from availability this is current line of code

<g:availability>{attribute="inventory|is_in_stock" format="as_is" parent="no" optional="yes" modify="replace:1^In Stock|replace:0^Out of Stock"}</g:availability>

 

i use multi warehouse stock module and i need to pull stock qty from 'Default source'

 

at moment the above code is just pulling in 'in stock' for every item. also I also use manage stock=no so i need code logic like this:

 

IF manage stock = no OR default source Qty =>1 then 'in stock'
 
ELSE 
'out of stock'

 

can anyone help me out with right code logic i can add between g tags please

 

regards

john

2 REPLIES 2

Re: Add stock/out of stock for google product feed

This code is structured with the idea of checking the "manage stock" setting first. If it's set to "no", it will directly print "In Stock". Otherwise, it'll check the quantity from "Default source" and determine the availability based on that. Ensure you consult with Amasty documentation or their support to correctly integrate this logic into your feed.  

 

<g:availability> {if attribute="manage_stock" format="as_is" parent="no" optional="yes" modify="replace:no^true|replace:yes^false"} {if attribute="default_source_qty" format="as_is" parent="no" optional="yes" compare=">=" value="1"} In Stock {else} Out of Stock {/if} {else} In Stock {/if} </g:availability>

Best regard,
TellTims

Re: Add stock/out of stock for google product feed

thank you so much!

 

i just tried code but get error 

 

Something went wrong:
Warning: Undefined array key 1 in /usr/local/www/bedstar-magento/vendor/amasty/feed/Model/FeedExport.php on line 233...