• Hello,
    I want to move products into wishlist via code.
    Is this possible?

    Ex. If I have two products with id 36 and 37 then can I move these 2 products into wishlist via code?

    Thanks in advance.

    Regards,
    Akshay Vyas

Viewing 1 replies (of 1 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi Akashay

    In order to add some product to the wishlist programmatically, you’ll need the following informations

    1. product id
    2. user_id (optional if you want to add item to the wishlist of the current user)

    Once you have this informations you can call the following snippet where needed

    
    YITH_WCWL()->details = array(
      'add_to_wishlist' => 'HERE PRODUCT ID',
      'user_id' => 'HERE USER ID, IF NEEDED'
    )
    YITH_WCWL()->add()
    

    Please, make sure that you execute this code at init or later

    Hope this helps
    Have a nice day

Viewing 1 replies (of 1 total)
  • The topic ‘Add product to wishlist via code’ is closed to new replies.