Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions includes/type/object/class-cart-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,14 @@ public static function register_applied_coupon() {
return \wc_graphql_price( $tax );
},
),
'description' => array(
'type' => 'String',
'description' => __( 'Description of applied coupon', 'wp-graphql-woocommerce' ),
'resolve' => function( $source, array $args ) {
$coupon = new \WC_Coupon( $source );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing class import via use statement (line '625', column '22').

return $coupon->get_description();
},
),
),
)
);
Expand Down
7 changes: 5 additions & 2 deletions tests/wpunit/CartMutationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ public function testApplyCouponMutation() {
$this->factory->coupon->create(
array(
'amount' => 0.5,
'product_ids' => array( $product_id )
'product_ids' => array( $product_id ),
'description' => 'lorem ipsum dolor',
)
)
);
Expand All @@ -445,6 +446,7 @@ public function testApplyCouponMutation() {
cart {
appliedCoupons {
code
description
}
contents {
nodes {
Expand Down Expand Up @@ -484,7 +486,8 @@ public function testApplyCouponMutation() {
$this->expectedNode(
'applyCoupon.cart.appliedCoupons',
array(
'code' => $coupon_code,
'code' => $coupon_code,
'description' => 'lorem ipsum dolor',
)
),
$this->expectedNode(
Expand Down