Argument #1 ($url) must be of type string, Drupal\Core\Url given

Created on 10 December 2024, 12 days ago

Problem/Motivation

I encountered this issue after adding a product variation to the cart, it happens when redirecting to see the product variant details, for example /shopify/redirect?variant_id=00000000000000, the following error appears in the URL in question and in the Recent log messages Argument #1 ($url) must be of type string, Drupal\Core\Url given, called in shopify/src/Controller/ShopifyRedirect.php on line 30 in Symfony\Component\HttpFoundation\RedirectResponse->__construct().

Steps to reproduce

Any version of Drupal.

1. Install module
2. Configure and install the module with Shopify
3. View a product that has options (variants)
4. Add the product variation to the cart.
5. Click to view product variation details
5. An error will be displayed or Check Recent log messages

Proposed resolution

The proposed solution is to call the toString() function after calling the toUrl() function to transform the Drupal\Core\Url class object into a string with the url.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇧🇷Brazil jonathandealmeida

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024