- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2022
02:26 AM
01-10-2022
02:26 AM
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
Labels:
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2022
06:15 PM
01-25-2022
06:15 PM
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
LitCommerce - The Most Simple & Affordable Multi-channel Selling Tool