Open sudhirbeldar opened 7 years ago
Are you importing the macro as follows: {% from "top-category.njk" import plpGrocery %}.
Also you might need the 'outofstock' variable value to be passed to it.
@sudhirbeldar how did it go, did you solved this since?
@revelt , Yes I got succeeded in cracking this out like as below.
We need to import the njk file in which macro is written {% import '_modules/product-listing-item-grocery.njk' as groceryOffer %}
Now we are free to call macro with it name using above instance. Here groceryOffer is an instance of njk file and plpGrocery is macro name {{ groceryOffer.plpGrocery(baseURL, wcsProductURL, cr) }}
I am having /template/_modules/top-category.njk in which I am calling a below macro {{ plpGrocery() }}
This is defined in /template/_modules/product-listing-item-grocery.njk {% macro plpGrocery(outofstock) %} ............ {% endmacro %}
While compiling I am getting error Template render error: (D:\POC_nunjucks\template_modules\top-category-offers.njk) Template render error: (D:\POC_nunjucks\template_modules\product-listing-item-grocery.njk) Error: Unable to call
plpGrocery
, which is undefined or falseyCan someone please help?