[Skip to main content](#vessel-content)

#   How to create a product category into hikashop programmatically

##

- **[twscott](/forum/user/43011-twscott "View twscott's Profile")**
- [![twscott's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/gallery/beer.png)](/forum/user/43011-twscott "View twscott's Profile") Topic Author
- [ Offline](/forum/user/43011-twscott)

Less More

- Posts: 252
- Thank you received: 1
-
-
-
-

8 years 5 months ago [\#294016](#294016) by [twscott](/forum/user/43011-twscott "View twscott's Profile")  *[How to create a product category into hikashop programmatically](/forum/32-content-creation/894988-how-to-create-a-product-category-into-hikashop-programmatically#294016 "-- HikaShop version -- : 3.4.0  Hi, I am asking to create product category by program, Is there document for it ?  Thanks")* was created by *[twscott](/forum/user/43011-twscott "View twscott's Profile")*

-- HikaShop version -- : 3.4.0

Hi,
I am asking to create product category by program, Is there document for it ?

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODk0OTg4LWhvdy10by1jcmVhdGUtYS1wcm9kdWN0LWNhdGVnb3J5LWludG8taGlrYXNob3AtcHJvZ3JhbW1hdGljYWxseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

8 years 5 months ago [\#294017](#294017) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to create a product category into hikashop programmatically](/forum/32-content-creation/894988-how-to-create-a-product-category-into-hikashop-programmatically#294017 "-- HikaShop version -- : 3.4.0  Hi, I am asking to create product category by program, Is there document for it ?  Thanks")*

Hi,

No, there is no documentation but it's quite easy: Code:

$category = new stdClass(); $category-&gt;category_name = "My new category"; $category-&gt;category_parent_id = XX; $categoryClass = hikashop_get('class.category'); $category_id = $categoryClass-&gt;save($category);

where XX is the id of the parent category.
Note that if you want to add an image you need also something like that: Code:

$file = new stdClass(); $file-&gt;file_ref_id = $category_id; $file-&gt;file_ref_type = 'category'; $file-&gt;file_path = 'YY' $fileClass = hikashop_get('class.file'); $fileClass-&gt;save($file);

where YY is the relative path of the image from the upload folder (setting of the HikaShop configuration).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vODk0OTg4LWhvdy10by1jcmVhdGUtYS1wcm9kdWN0LWNhdGVnb3J5LWludG8taGlrYXNob3AtcHJvZ3JhbW1hdGljYWxseT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.058 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
