cancel
Showing results for 
Search instead for 
Did you mean: 

around plugin error | too few to function ::resolve()

around plugin error | too few to function ::resolve()

  • his function runs around the resolve function for coupon api on Graphql,
  • once the core function throws exception this function will catch and update the error message.

core file [module-quote-graph-ql/Model/Resolver/ApplyCouponToCart.php]

public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
   { ... 

My around plugin code in correct namespace...

      public function aroundResolve(ApplyCouponToCart $subject, callable $proceed, $cartId, $result, $couponCode)
        {
           
            $result = false;

The Postman error im getting

1 REPLY 1

Re: around plugin error | too few to function ::resolve()

You're missing to forward those agruments in your around function:

... Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)

You can try:

public function aroundResolve(ApplyCouponToCart $subject, callable $proceed, Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
{
...
}

Or if you are not using/modifying the arguments, you could use variadics and argument unpacking to achieve this:

public function aroundResolve(ApplyCouponToCart $subject, callable $proceed, ...$args)
{
...
}
If issue solved, Click Kudos & Accept as Solution.
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool