• Resolved suifengtec

    (@suifengtec)


    How to apply coupons for a new order via WooCommerce REST API v2?
    I’ve tried:

    "coupon_lines"=>array(
                                        array(
                                        'id'=>'18',
                                        'code'=>'off-12',
                                        'type'=>'percent',
                                        'amount'=>'12.00'
                                        )
                                    )

    the above code does not work !
    I’ve tried:

    "coupon_lines"=>array(
                                        array(
                                      /*  'id'=>'18',*/
                                        'code'=>'off-12',
                                        'type'=>'percent',
                                        'amount'=>'12.00'
                                        )
                                    )

    OOPS!
    it does not work yet!

    How to do with it?
    Anyone help?

    https://www.ads-software.com/plugins/woocommerce/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi, I was having the same problem you have.

    Since you are creating a new Order, you must set the following

    "coupon_lines"=>array(
    	array(
    		/*  'id'=>'18',*/
    		'code'=>'off-12',
    		/*'type'=>'percent',*/
    		'amount'=>'12.00' //This is optional, must be greater than 0
    		)
    	)
    swap_ba

    (@swap_ba)

    Hi,

    I too had the same issue just wanted to know if you have solve this.

    I have solve this by adding fee that have title as “disount” and amount same as coupon discount but in negative so fee will be added with title discount and amount will be subtracted from total amount.

    If you have solve this issue then please do share this with us.

    Thread Starter suifengtec

    (@suifengtec)

    I solved this problem by coding a custom function.

    Thread Starter suifengtec

    (@suifengtec)

    Thanks for your tip!

    I have the same issue and coupon is not applied while sending an order. any help ?

    @suifengtec

    I have also same issue in api.I can’t aplly coupon to new order when create order using rest api in mobile.Can you suggest me how can i fix it or send me code you have developed.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to apply coupons for a new order via WooCommerce REST API v2’ is closed to new replies.