Please refer to TemplateMonster Support for any issues surrounding TemplateMonster/TemplateTuning Themes – thanks, Jigoshop Team

Coupon to add a product as a gift in the checkout page


11 Mar, 2013 12:27 PM


I know that with Jigoshop Coupons is possible to add coupon discounts to the cart/product. But there is anyway to create a Coupon that will add a product as a gift in the checkout page?

I think I can do it by coding, but if there is any easy way (some plugin or trick) to do that it would be great :)


  1. Support Staff 2 Posted by chriscct7 on 11 Mar, 2013 01:17 PM

    chriscct7's Avatar

    Not that I can think of at the moment. What you could do (programmically) is capture the post of the coupon in our function, post validation of still valid, then add to cart an item, and set the item's price to 0 for that user.


  2. 3 Posted by franrcardenas on 11 Mar, 2013 02:04 PM

    Great, so I will try to do that.


  3. 4 Posted by franrcardenas on 12 Mar, 2013 06:18 PM

    How can I add an item to the shopping cart after the post of the coupon insert having the item ID? I know where I need to do that, but not what function I need to use to add the item to the cart having the item ID.


  4. Support Staff 5 Posted by chriscct7 on 13 Mar, 2013 03:57 AM

    chriscct7's Avatar

    You can just use a version of Jigoshop's normal add to cart function. Found in temploate-functions.php for reference.

  5. Support Staff 6 Posted by chriscct7 on 13 Mar, 2013 03:58 AM

    chriscct7's Avatar

    Obviously don't edit the core files, because that will cause issues with your site. I presume your making this in a new plugin.

  6. 7 Posted by franrcardenas on 13 Mar, 2013 06:26 PM

    Thank you, I have found a way to add the product to the cart:

    $product_id = apply_filters('jigoshop_product_id_add_to_cart_filter', (int) $coupon['include_products'][0]);
    $quantity = 1;
    // Add to cart validation
    $is_valid   = apply_filters('jigoshop_add_to_cart_validation', true, $product_id, $quantity);
    // Add to the cart if passsed validation
    if ( $is_valid ) {
        if ( jigoshop_cart::add_to_cart($product_id, $quantity) ) $product_added = true;

    But how can I set the price of this product to 0?


  7. franrcardenas closed this discussion on 26 Apr, 2013 08:43 AM.

Comments are currently closed for this discussion. You can start a new one.