In this post I am going to explain how to get current customer group id in PrestaShop 1.7.
1) Inside module or controller file (php)
1 2 3 4 5 6 7 | if ($this->context->customer->isLogged()) { $customerGroupId = $this->context->customer->id_default_group; echo $customerGroupId . "<br>"; // Do something here } else { // Do something here } |
2) Inside template file (tpl)
1 2 3 | {if $customer.is_logged} {$customer.id_default_group} {/if} |
Write an article about ecommerce that help people to grow their ecommerce business. You’ll find best ecommerce guide, news, tips & more!
Leave a Reply