File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -618,6 +618,14 @@ public static function register_applied_coupon() {
618618 return \wc_graphql_price ( $ tax );
619619 },
620620 ),
621+ 'description ' => array (
622+ 'type ' => 'String ' ,
623+ 'description ' => __ ( 'Description of applied coupon ' , 'wp-graphql-woocommerce ' ),
624+ 'resolve ' => function ( $ source , array $ args ) {
625+ $ coupon = new \WC_Coupon ( $ source );
626+ return $ coupon ->get_description ();
627+ },
628+ ),
621629 ),
622630 )
623631 );
Original file line number Diff line number Diff line change @@ -427,7 +427,8 @@ public function testApplyCouponMutation() {
427427 $ this ->factory ->coupon ->create (
428428 array (
429429 'amount ' => 0.5 ,
430- 'product_ids ' => array ( $ product_id )
430+ 'product_ids ' => array ( $ product_id ),
431+ 'description ' => 'lorem ipsum dolor ' ,
431432 )
432433 )
433434 );
@@ -445,6 +446,7 @@ public function testApplyCouponMutation() {
445446 cart {
446447 appliedCoupons {
447448 code
449+ description
448450 }
449451 contents {
450452 nodes {
@@ -484,7 +486,8 @@ public function testApplyCouponMutation() {
484486 $ this ->expectedNode (
485487 'applyCoupon.cart.appliedCoupons ' ,
486488 array (
487- 'code ' => $ coupon_code ,
489+ 'code ' => $ coupon_code ,
490+ 'description ' => 'lorem ipsum dolor ' ,
488491 )
489492 ),
490493 $ this ->expectedNode (
You can’t perform that action at this time.
0 commit comments